Last active
December 8, 2020 18:16
-
-
Save jahe/dbb57eb02787a5cf261f to your computer and use it in GitHub Desktop.
Docker Cheatsheet
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
# 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