Skip to content

Instantly share code, notes, and snippets.

@jahe
Last active December 8, 2020 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jahe/dbb57eb02787a5cf261f to your computer and use it in GitHub Desktop.
Save jahe/dbb57eb02787a5cf261f to your computer and use it in GitHub Desktop.
Docker Cheatsheet
# Start VM
boot2docker start
# Show VM status
boot2docker status
# Start an nginx container "web" on the docker_host (the vm)
# -d keeps the container running in the background
# -P publishes exposed ports from the container to your local host (öffnet die vom Container genutzten Ports)
# --name assigns a name to the container
# nginx is the name of the image
docker run -d -P --name web nginx
# Display running container
docker ps
# Display just the containers ports
docker port web
# Get the IP-Address of the VM
boot2docker ip
# Stop a container (web is the container name assigned within the docker run command)
docker stop web
# Remove a container
docker rm web
# Start an nginx container "mysite" and share a directory "site" from the users home directory (shared with the VM)
# -v creates a bind mount with [host-dir]:[container-dir]:[rw|ro]
docker run -d -P -v $HOME/site:/usr/share/nginx/html --name mysite nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment