Skip to content

Instantly share code, notes, and snippets.

@jbryson3
Last active June 17, 2016 15:44
Show Gist options
  • Save jbryson3/fe90be5857ba31cac05cad9cfd17c6e2 to your computer and use it in GitHub Desktop.
Save jbryson3/fe90be5857ba31cac05cad9cfd17c6e2 to your computer and use it in GitHub Desktop.
Docker Commands
# Build an image from Dockerfile in current dir
docker build -t image-name .
# List images
docker images
# List containers
docker ps
# Run a docker container from image, mount a live volume, and ssh into it
docker run -t -i -v /home/jbryson3/code:/home/code image-name /bin/bash
# Run docker container in background exposing a port
docker run -d -p 8002:8002 image-name
####################
# Cleanup Commands #
####################
# Remove exited containers (using fish shell)
docker rm (docker ps -f "status=exited" -q)
# Remove none:none images
docker rmi (docker images -f "dangling=true" -q)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment