Last active
October 15, 2019 00:32
-
-
Save birchestx/b078f921be10a8e0a939 to your computer and use it in GitHub Desktop.
Docker cheat commands
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 new Image (uses dockerfile in cwd) | |
docker build -t <your-desired-image-name> . | |
#Run Docker Container | |
docker run <image-name> | |
#Stop Docker Container (if you have used --name you can then stop with actual alias name) | |
docker stop <image-id> | |
#Show running Docker Images | |
docker ps | |
#Run Container and ssh in | |
docker run -ti <image-name> /bin/bash | |
#ssh into existing container | |
docker exec -it <image-id> bash | |
#Run Container with specific alias name (useful for linking containers) | |
docker run -d -P --name <image-alias> <image-name> | |
#Get Docker Machine IP (needed if you want to access container e.g. tomcat) | |
docker-machine ip default | |
# Delete all containers | |
docker rm $(docker ps -a -q) | |
# Delete all images (be wary of using this one) | |
docker rmi -f $(docker images -q) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment