Docker Cheat Sheet

Best Practices

Bash completion:

Bash completion needs the utility installed.  On OSX follow these steps: 

  2. Do not skip the linked Stack Overflow on properly installing bash-completion using brew on OSX

Running without root (not using sudo)

Docker runs as root on a host machine.  With most Linux installs, you'll need to give your user account access to docker so that you don't need to run every Docker command with sudo.


In OS X (and likely Windows), using Docker Machine is essentially using VirtualBox.  The default virtual machine you created through Docker Machine likely was created to use one CPU, set memory etc.  It can be very useful to increase these virtual machine limits.  The general steps are:

  1. Open VirtualBox
  2. Stop docker's virtual machine (likely named "default")
  3. Right click on virtual machine, go to Settings
  4. Go to Tab: System
  5. Adjust memory size and CPU on Motherboard and Processor tabs respectively.

Docker on Windows

Helpful scripts:

Cleaning up:

Docker recently added a docker system prune command which can be used for thorough and convenient cleanup. Environments which don't yet sport the command, however, offer the following alternatives.  

  • Remove unused volumes (do not run on <= 1.9): 

  • Remove unused images:

  • Remove all exited containers:


  • Attempt to remove all networks:

View running containers:

This shows a real-time list of containers by ID with their CPU and Memory usage:

More Resources