Created
January 14, 2021 13:01
-
-
Save fcakyon/b6807104e384914bcb063896657718c6 to your computer and use it in GitHub Desktop.
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
# To build docker image using dockerfile: | |
docker build -t new_image_name:tag_name -f Dockerfile.custom . | |
# To build docker image from container: | |
docker commit container_id new_image_name:tag_name | |
# To create docker container using docker image (also mount host directory into docker): | |
nvidia-docker run -v /host/directory/to/mount/:/docker/directory/ -ti image_name:tag_name | |
# To start existing docker container: | |
docker start container_id | |
docker exec -it container_id /bin/bash | |
# To continue currently running docker container: | |
docker attach container_id | |
# To list all docker containers: | |
docker container ps -a | |
# To remove a docker container: | |
docker rm container_id | |
# To list all docker images: | |
docker images | |
# To remove a docker image: | |
docker rmi image_id | |
# To rename a docker container: | |
docker container rename container_id new_container_name | |
# To rename a docker image: | |
docker tag image_id new_image_name | |
# To save a docker image as .tar: | |
docker save -o <path for generated tar file> image_id | |
# To load a docker image: | |
docker load -i <path to image tar file> | |
# To leave a docker container without stopping it: | |
CTRL+P, CTRL+Q |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment