
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
To check the currently installed version of docker
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