Docker Cheat Sheet & Quick Reference
Docker Cheat Sheet & Quick Reference
This is a quick reference cheat sheet for Docker. And you can find the most common Docker commands here.
# Getting Started
Getting started
Information
Creating
Example
Manipulating
Renaming a Container
Removing a Container
docker rm my-nginx
Updating a Container
# Docker Images
Manipulating
Building Images
$ docker build .
$ docker build github.com/creack/docker-firefox
$ docker build - < Dockerfile
$ docker build - < context.tar.gz
$ docker build -t eon/my-nginx .
$ docker build -f myOtherDockerfile .
$ curl example.com/remote/Dockerfile | docker build -f - .
# Docker Networking
Manipulating
Removing a network
Listing networks
docker network ls
Creating Networks
Cleans up dangling images, containers, volumes, and networks (ie, not associated with a container)
Additionally, remove any stopped containers and all unused images (not just dangling images)
Containers
Images
Remove all dangling (not tagged and is not associated with a container) images:
Volumes
# Miscellaneous
Docker Hub
Registry commands
Login to a Registry
$ docker login
$ docker login localhost:8080
Logout from a Registry
$ docker logout
$ docker logout localhost:8080
Searching an Image
Pulling an Image
Pushing an Image
Batch clean
Volumes
Check volumes
$ docker volume ls