PyTorch+CUDA용 Docker file

3134 단어 DockerPyTorchCUDAtech

일반적 상황


아래에서 PyTorch 및 CUDA 버전 선택
https://hub.docker.com/r/pytorch/pytorch/tags?page=1&ordering=last_updated

콘다를 사용하고 싶지 않은 경우.


FROM nvidia/cuda:11.0.3-runtime-ubuntu18.04
WORKDIR /app
RUN apt-get update
RUN apt-get install -y software-properties-common tzdata
ENV TZ=Asia/Tokyo 
RUN add-apt-repository ppa:deadsnakes/ppa
RUN apt-get -y install python3.9 python3.9-distutils python3-pip
RUN python3.9 -m pip install -U pip wheel setuptools
RUN python3.9 -m pip install torch==1.7.1+cu110 -f https://download.pytorch.org/whl/torch_stable.html
cuda,os,pythorch의 버전을 적합한 버전으로 바꾸십시오

참고물

  • 기본방침
    https://codechacha.com/ja/ubuntu-install-python39/
  • pip 삽입
    https://stackoverflow.com/questions/68185770/installing-python3-9-and-pip-in-docker-image-and-not-python-3-8
  • 시간대 선택 요청
    https://sleepless-se.net/2018/07/31/docker-build-tzdata-ubuntu/
  • python3.9-m pip 시 import 오류
    https://stackoverflow.com/questions/63823964/importerror-cannot-import-name-sysconfig-from-distutils-usr-lib-python3-8 ImportError: cannot import name 'sysconfig' from 'distutils' (/usr/lib/python3.9/distutils/__init__.py)
  • Docker 구축 시 exit code:137에서 드랍
    6GB 메모리
    https://stackoverflow.com/questions/57291806/docker-build-failed-after-pip-installed-requirements-with-exit-code-137 /bin/sh -c pip3 install torch==1.7.1+cu110 -f https://download.pytorch.org/whl/torch_stable.html: exit code: 137
  • 좋은 웹페이지 즐겨찾기