[Docker]#1 Nvidia-docker setting

Clay Ryu's sound lab·2023년 10월 3일
0

Framework

목록 보기
32/49
post-thumbnail

Docker

Delete docker first

Refer to the following post: https://boramchan-corgi.tistory.com/13

Nvidia-docker install

https://nvidia.github.io/nvidia-container-runtime/

sudo apt-get update
sudo apt install curl
curl -s -L https://nvidia.github.io/nvidia-container-runtime/gpgkey | \
  sudo apt-key add -
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-container-runtime/$distribution/nvidia-container-runtime.list | \
  sudo tee /etc/apt/sources.list.d/nvidia-container-runtime.list
sudo apt-get install nvidia-container-runtime 
sudo apt install docker.io
sudo chmod 666 /var/run/docker.sock

sudo apt-get update
sudo apt-get install -y nvidia-docker2

docker image upload (optional)

docker login


but it takes a lot of time, I guess downloading predefined images and adapting a new image on it is much faster than uploading my image

docker image download

https://hub.docker.com/r/nvidia/cuda/tags

(optional)changing image download directory

https://dongle94.github.io/docker/docker-image-storage-change/

# daemon.json update
{
   "runtimes": {
      "nvidia": {
         "path": "nvidia-container-runtime",
         "runtimeArgs": []
      }
   },
   "data-root": "/home/docker"
}

(optional)when requiring permission in calling docker

pull images

docker pull nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04

# build your image from "nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04" in dockerfile
vim dockerfile
# make it into real image
# 1st base image
docker build -t clay/maler-torch:cu11.8cudnn8torch2.0 .
# 2nd specific image for specific users or docker settings
docker build -t clay:00 .
# make container from images
sudo docker run -it --gpus 'device=1' --cpus=12 --memory=128G -p 18185:22 -p 18186:8888 -v /home/maler/clay-storage:/home/clay/userdata --name clay --shm-size 32G clay:00
profile
chords & code // harmony with structure

0개의 댓글