Last active
August 22, 2017 20:19
-
-
Save alicanerdogan/0707e33a05596e31ec9b5a13e21c5625 to your computer and use it in GitHub Desktop.
Docker Cheat Sheet
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
# list all containers dead or alive | |
docker ps -a | |
# stop and remove all containers | |
docker stop $(docker ps -a -q) | |
docker rm $(docker ps -a -q) | |
# create a container | |
export ENTRY_POINT=bash | |
docker run -d -it --name $CONTAINER_NAME -v $HOST_MOUNT_POINT:$GUEST_MOUNT_POINT -p $HOST_PORT:$GUEST_PORT $IMAGE $ENTRY_POINT | |
# attach an alive container with bash | |
docker exec -it $CONTAINER_NAME bash | |
# checkout latest output from a container | |
docker logs $CONTAINER_NAME | |
# build an image | |
docker build -t $IMAGE_NAME:$IMAGE_VERSION . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment