The purpose of this Gist is to provide a quick list of common Docker commands. This information was pulled from the summary at the bottom of Part 2 of the official Docker tutorial: https://docs.docker.com/get-started/part2
Run "friendlyname" mapping port 4000 to 80
$ docker run -p 4000:80 friendlyhello
Same thing, but in detached mode
$ docker run -d -p 4000:80 friendlyhello
Run image from a registry
$ docker run username/repository:tag
List all running containers
$ docker container ls
List all containers, even those not running
$ docker container ls -a
Gracefully stop the specified container
$ docker container stop <hash>
Force shutdown of the specified container
$ docker container kill <hash>
Remove specified container from this machine
$ docker container rm <hash>
Remove all containers
$ docker container rm $(docker container ls -a -q)
Create image using this directory's Dockerfile
$ docker build -t friendlyhello .
List all images on this machine
$ docker image ls -a
Remove specified image from this machine
$ docker image rm <image id>
Remove all images from this machine
$ docker image rm $(docker image ls -a -q)
Log in this CLI session using your Docker credentials
$ docker login
Tag <image>
for upload to registry
$ docker tag <image> username/repository:tag
Upload tagged image to registry
$ docker push username/repository:tag
Create a new volume
$ docker volume create my-volume
View list of existing volumes
$ docker volume ls
View details of a specific volume
$ docker volume inspect my-volume
Remove a volume
$ docker volume rm my-volume
Mount a volume when starting a container (create if not exist)
$ docker run -d --name my-container --mount type=volume,source=my-volume,target=/mnt/my-volume,ro my-container-image
Removing a volume from a container
$ docker volume rm my-container
$ docker run -d --name my-container --mount type=bind,source="$(pwd)"/my-directory,target=/mnt/my-directory,ro my-container