Skip to content

Instantly share code, notes, and snippets.

@alexisrolland
Created February 8, 2020 15:35
Show Gist options
  • Save alexisrolland/2c22e6a1162f45da9fad9503e95940b0 to your computer and use it in GitHub Desktop.
Save alexisrolland/2c22e6a1162f45da9fad9503e95940b0 to your computer and use it in GitHub Desktop.
Some useful examples of Docker commands which I'm tired to type over and over again...
# Connect to running container in interactive mode in a shell prompt
$ docker exec -it container_name sh
# Same as above with auto-remove and Docker network
$ docker run -it --rm --network network_name container_name sh
# Same as above with mounted volume (Windows Pro)
$ docker run -it --rm --network network_name -v "C:\host_path:/guest_path" container_name sh
# Same as above with mounted volume (Windows Home)
$ docker run -it --rm --network network_name -v "/c/host_path:/guest_path" container_name sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment