A list of common use commands
Note that you may need to prefix these commands with sudo, if your account doesn't have the required permission to run docker 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 attach container_name
This command will reconnect you to an interactive session, if one exists on your container.
$ 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 $(sudo docker ps -a -q)
This will stop all containers.
$ sudo docker rm -f $(sudo docker ps -a -q)
This will forcibly remove all containers
Thanks for visiting.