How to use docker
Docker 소개
How to use docker
- Download wanted docker image, use the codes below
# For example, download pytorch image
docker pull pytorch/pytorch
- Create docker container
# Name(image): pytorch/pytorch
# Name(container): container_name
# -i: interactive model enable
# -t: tty mode enable
# -d: debug mode enable
# --gpus all: use all of accessible gpus
# --gpus '"device=0,2"': use gpus:0 and 2 only
# --name container_name: declare name of the container
# -v: mount option
# --shm-size: allocate memory
# --restart=always: enable executing docker container without precedent 'docker start'
docker run -itd --gpus '"device=0,2"' -v local_dir:remote_dir -v local_dir2:remote_dir2 --shm-size 20G --name container_name --restart=always pytorch/pytorch
# Examples
docker run -it -v ~/Desktop/mnt/Privacy_preserving:/workspace/mnt -v /data/DDE:/workspace/local --shm-size 20G --gpus all --name ych --restart=always pytorch/pytorch
# -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY
# Enable docker container to work with X Windows (necessary when using COLMAP in docker container)
# Extra 'xhost +local:docker_container' is required
docker run -it -v ~/Desktop/mnt/Privacy_preserving:/workspace/mnt -v /data/DDE:/workspace/local -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY --shm-size 20G --gpus all --name ych --restart=always cksgurdbs/ych_colmap2
- Execute the container
docker exec -it container_name bash
- Stop docker container
docker stop container_name
- Remove docker container
Stop the docker container before you remove it
docker rm container_name
댓글남기기