DevOps Classroom series – 30/Jan2020

Container States

  • Running (Started)
  • Exited (Stopped)
  • Paused

Docker Container Creation modes

  • Attached mode:
    • Our terminal will recieve outputs from containter stdout, stderr
    docker container run jenkins
    
    # press ctrl+c to exit the container and also the container outputs to your terminal
    
  • Detached Mode (background)
    • Container runs in the background an you will recieve container id
    docker container run -d jenkins
    
  • Interactive Terminal
    • Create a container and login into interactive shell
    docker container run -it jenkins /bin/bash
    docker container run -it alpine /bin/sh
    
    

Listing Containers

  • docker container ls or docker ps will show all the containers in running state
  • docker container ls -a or docker ps -a will show all the containers in running and stopped state

Removing Containers

  • Containers can be removed from stopped state, if they are in running state you have to force the delete
  • To remove containers we need name/id
docker container rm <name-or-id>

docker container rm <name-or-id-container1> <name-or-id-container2> .. 
  • To remove all the containers
docker container rm -f $(docker container ls -a -q)

Docker CLI

  • Cheatsheet
  • use –help
docker container run --help

Leave a ReplyCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Social Media Icons Powered by Acurax Web Design Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Exit mobile version
%%footer%%