A list of common use commands

dockerThis is a list of commands you can use with Docker, including a brief description of what they do.

 


Commands

 

$ docker --version

This will display the version of docker in use.

 

$ docker info

This will display comprehensive information about your docker installation, including how many images and containers there are, and lots of othe information, including the Docker version.

 

$ docker run hello-world

This will test the Docker configuration, by pulling the 'hello-world' image and running it once as a container, giving some very succinct output.

 

$ docker image ls

This will list all current images available to this Docker host (e.g. including hello-world, if you've run the previous command).

 

$ docker container ls -all

Lists all containers, including ones that have run since this Docker host was last started up.

 

$ docker ps

This will list all running containers. Adding an -a flag lists all containers, both stopped and running.

 

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

This will stop all containers.

 

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

This will forcibly remove all containers

 

Thanks for visiting.