Last active
June 11, 2020 22:41
-
-
Save hamzabasrai/90f899b1f313ca0283018b7a9fb86b01 to your computer and use it in GitHub Desktop.
[Docker] List of common docker commands #docker
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
# List Docker networks | |
docker netowrk | |
# Creates a 'bridge' network by default | |
docker network create $NETWORK_NAME |
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
# Run Docker container | |
docker run $IMAGE | |
# --rm: Automatically remove the container when it exits | |
docker run --rm $IMAGE | |
# -d: Run container in background and print container ID | |
# -p: Publish $CONTAINER_PORT to $HOST_PORT | |
docker run -d -p $HOST_PORT:$CONTAINER_PORT $IMAGE | |
# -i: Create interactive shell | |
# -t: Attach to shell | |
docker run -it $IMAGE | |
# --net: Run container inside a given Docker network | |
docker run --net $NETWORK_NAME $IMAGE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment