Docker – Command Line Cheat Sheet

February 01, 2021

To get Docker version and info

$ docker --version

To get Docker details

$ docker version

Build Docker image with tag

docker build -t <image-name> .

Push Docker image

docker push <image-name>

Execute Docker image

docker run <image-name>
docker run --rm -p 3005:3005 <image-name>
docker run -d -p 5672:5672 -p 15672:15672 <image-name>

List Docker images

docker image ls

List Docker containers (running, all, all in quiet mode)

docker container ls
docker container ls --all
docker container ls -aq

List Docker Networks

docker network ls
docker network inspect bridge

Stop and remove all Docker containers

docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)

Profile picture

I'm a software engineer, lives in Chennai, India. Full Stack developer and Certified Microsoft Azure DevOps Expert. Love to travel, cycling, reading non-fiction books, architecture photography. Fan of Minimalism.
More about me → My Projects →