s

commonly used docker commands edit button Edit

author
Murugan Andezuthu Dharmaratnam | calendar 10 January 2022 | 2059

here is the list of commonly used docker commands.

Docker Commands

list all images 
docker images

remove images
docker rmi imageid

remove all unused images
docker image prune

remove container 
docker rm 

remove all stopped container
docker container prune

buidling image
docker build -f dockerfile .
or
docker build -t html-hello-world:v1 
-t is used to specify the tag and value

running
docker run imageid
docker run imageid -d # detached mode run in the background
or 
docker run -d -p 8080:80 html-hello-world:v1
-p is used to bind port 80 of the container to TCP port 8080 of the host machine.
-d is to specify detached mode to run in the background

check running containers
docker container ls -a