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
docker container run --help
Like this:
Like Loading...