Docker commands : A Ultimate list

Docker commands : A Ultimate list

Here we have prepared a list of commands that may be useful to you on Docker.

Useful commands for Docker

Docker version

docker --version

List your images.

$ docker image ls

Delete a specific image.

$ docker image rm [image name]

Delete all existing images.

$ docker image rm $(docker images -a -q)

List all existing containers (running and not running).

$ docker container ls  (will list only running container)
$ docker container ls -a (will list all containers)

Start existing container.

docker container start [container-id/Name]

Stop a specific container.

$ docker stop [container-id/Name]

Stop all running containers.

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

Delete a specific container (only if stopped).

$ docker rm [container name]

Delete all containers (only if stopped).

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

Display logs of a container.

$ docker logs [container name]

Remove Unused container

docker container prune

Remove Unused images

$ docker image prune

Clean work system

docker system prune -a

Subscribe to our Newsletter

Stay up to date! Get all the latest posts delivered straight to your inbox.

If You Appreciate What We Do Here On TutsCoder, You Should Consider:

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

Leave a Comment