Created
September 13, 2018 18:37
-
-
Save basus/7feb0a8204e00f81b74744e7ba1c358b to your computer and use it in GitHub Desktop.
Docker shortcuts
This file contains hidden or 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 a container from an image, daemonized, with port forwarding. | |
# This runs whatever CMD the image is set to run. | |
docker run -d -p 8000:8000 <image name> | |
# Run a bash shell in a already-running container. | |
# Exiting this shell will stop the container. | |
docker exec -it <container name/id> bash | |
# Restart the container. This is required after exiting a shell running | |
# on it via the above command. This is also required if a container is | |
# explicitly stopped using the container below. | |
docker restart <container name/id> | |
# Stop the container. | |
docker stop <container name/id> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment