Skip to content

Instantly share code, notes, and snippets.

@hamzabasrai
Last active June 11, 2020 22:41
Show Gist options
  • Save hamzabasrai/90f899b1f313ca0283018b7a9fb86b01 to your computer and use it in GitHub Desktop.
Save hamzabasrai/90f899b1f313ca0283018b7a9fb86b01 to your computer and use it in GitHub Desktop.
[Docker] List of common docker commands #docker
# List Docker networks
docker netowrk
# Creates a 'bridge' network by default
docker network create $NETWORK_NAME
# 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