Skip to content

Instantly share code, notes, and snippets.

@jsonfry
Last active October 14, 2020 09:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jsonfry/2b9a930905d8b7b83613 to your computer and use it in GitHub Desktop.
Save jsonfry/2b9a930905d8b7b83613 to your computer and use it in GitHub Desktop.
Docker Help

Install Docker

  1. Install Docker For Mac if you haven't already

  2. Start the Docker For Mac App

  3. Open a Terminal window - (iTerm2 is nicer than Mac's built in one)

  4. Login to Docker Hub if you haven't already. You'll need to create an account on their website if you don't already have one.

    docker login

  5. Add an entry to your /etc/hosts file if you haven't already:

    127.0.0.1 docker.local

Useful Docker Commands

Show running containers

docker ps

Show all containers

docker ps -a

Stop running containers

docker stop $(docker ps -a -q)

Update all images

docker images | awk '/^REPOSITORY|\<none\>/ {next} {print $1}' | xargs -n 1 docker pull

Delete all containers

docker ps -a -q | xargs -n 1 -I {} docker rm {}

Delete all unused images

docker image prune
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment