Skip to content

Instantly share code, notes, and snippets.

@anupambhatnagar
Last active January 16, 2024 20:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anupambhatnagar/07ebff374bc45e4b63eb42893cca7e87 to your computer and use it in GitHub Desktop.
Save anupambhatnagar/07ebff374bc45e4b63eb42893cca7e87 to your computer and use it in GitHub Desktop.
Commonly used Docker commands
# Launch container and enter shell
docker run --rm -it <image_name>
# Create image from docker file
docker build -t <image_name:tag> -f /path/to/dockerfile .
# Create image from running container
docker commit <container_id> <account_name/image_name:tag>
# Push image to docker hub
docker push <image_name:tag>
# Run docker container with gpus
docker run -it --gpus all <image_name:tag>
# Stop a container
docker stop <CONTAINER_NAME>
# Delete an image
docker image rm <IMAGE:TAG>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment