docker pytorch离线安装
先在ubuntu 18.04 64位环境里,有联网情况下操作:
安装docker pytorch镜像:
docker pull pytorch/pytorch:1.13.0-cuda11.6-cudnn8-runtime
下载依赖:
bonelee@ubuntu:~/Desktop/pythonProject$ sudo docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES fde7f2d55f74 pytorch/pytorch:1.13.0-cuda11.6-cudnn8-devel "/bin/bash" 3 minutes ago Up 3 minutes peaceful_goldwasser bonelee@ubuntu:~/Desktop/pythonProject$ sudo docker commit fde7f2d55f74 my-pytorch-image:v1.0 sha256:1ead4c99085af4bea1829fe0bacea32c4d0f9ee4be36da62da4410ff5ae508fb bonelee@ubuntu:~/Desktop/pythonProject$ sudo docker images REPOSITORY TAG IMAGE ID CREATED SIZE my-pytorch-image v1.0 1ead4c99085a 44 seconds ago 21.4GB hello-world latest d2c94e258dcb 12 months ago 13.3kB pytorch/pytorch 1.13.0-cuda11.6-cudnn8-devel 632278b72312 18 months ago 18.6GB bonelee@ubuntu:~/Desktop/pythonProject$ docker save -o my-pytorch-image.tar my-pytorch-image:v1.0 Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.40/images/get?names=my-pytorch-image%3Av1.0: dial unix /var/run/docker.sock: connect: permission denied bonelee@ubuntu:~/Desktop/pythonProject$ sudo docker save -o ../my-pytorch-image.tar my-pytorch-image:v1.0
如果遇到空间不够:
bonelee@ubuntu:~/Desktop$ sudo docker rmi --force pytorch/pytorch:1.13.0-cuda11.6-cudnn8-devel Untagged: pytorch/pytorch:1.13.0-cuda11.6-cudnn8-devel Untagged: pytorch/pytorch@sha256:d98a1b1f61166875882e5a3ffa63bdef89c3349ceca1954dda415c5cd67e06a0 bonelee@ubuntu:~/Desktop$ sudo docker system prune -f Deleted Containers: cc8a17a3e699a188e202e528b5ccd6344468d54bc359518449dcce977e278d32 fde7f2d55f743e76c3d817b00fc8e28a3aad61becba12a4d4ddcc9aaab37fc76 Total reclaimed space: 2.786GB