Last active
January 15, 2018 18:50
-
-
Save bradwestfall/64ec914dcdd9fce3724dfeea21c2eece to your computer and use it in GitHub Desktop.
Docker Cheat Sheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Build a container from a local Dockerfile | |
# 1. -t is the tagname | |
# 2. The appname is any name we want to distinguish containers | |
# 3. . the path to Dockerfile | |
docker build -t <appname> . | |
# List Images | |
docker images | |
# Remove an Image | |
docer rmi <imageid> <imageid> | |
docer rmi <appname> <appname> | |
# Remove All Images | |
docker rmi $(docker images -a -q) | |
# Run a container (also creates a container if it doesn't exist) | |
docker run <appname> | |
# Or, with more settings | |
# -d detached mode | |
# -rm remove the container after it's exited | |
docker run -p 3000:3000 -d -rm <appname> | |
# Show running containers | |
docker ps -a | |
# To stop, start, or remove an existing container that was created with docker run | |
docker stop <containerid> | |
docker start <containerid> | |
docker rm <containerid> | |
# To Remove all containers | |
docker rm $(docker ps -a -q) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment