github.com/kubeflow/training-operator@v1.7.0/examples/pytorch/pytorch_cuda_docker/Dockerfile (about)

     1  FROM nvidia/cuda:9.2-base-ubuntu16.04
     2  
     3  # Install some basic utilities
     4  RUN apt-get update && apt-get install -y \
     5      curl \
     6      ca-certificates \
     7      sudo \
     8      git \
     9      bzip2 \
    10      libx11-6 \
    11   && rm -rf /var/lib/apt/lists/*
    12  
    13  # Create a working directory
    14  RUN mkdir /app
    15  WORKDIR /var
    16  
    17  # Create a non-root user and switch to it
    18  
    19  
    20  # All users can use /home/user as their home directory
    21  ENV HOME=/var
    22  RUN chmod 777 /var
    23  
    24  # Install Miniconda
    25  RUN curl -so ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-4.5.11-Linux-x86_64.sh \
    26   && chmod +x ~/miniconda.sh \
    27   && ~/miniconda.sh -b -p ~/miniconda \
    28   && rm ~/miniconda.sh
    29  ENV PATH=/var/miniconda/bin:$PATH
    30  ENV CONDA_AUTO_UPDATE_CONDA=false
    31  
    32  # Create a Python 3.6 environment
    33  RUN /var/miniconda/bin/conda create -y --name py36 python=3.6.9 \
    34   && /var/miniconda/bin/conda clean -ya
    35  ENV CONDA_DEFAULT_ENV=py36
    36  ENV CONDA_PREFIX=/var/miniconda/envs/$CONDA_DEFAULT_ENV
    37  ENV PATH=$CONDA_PREFIX/bin:$PATH
    38  RUN /var/miniconda/bin/conda install conda-build=3.18.9=py36_3 \
    39   && /var/miniconda/bin/conda clean -ya
    40  
    41  # CUDA 9.2-specific steps
    42  RUN conda install -y -c pytorch \
    43      cudatoolkit=9.2 \
    44      "pytorch=1.2.0=py3.6_cuda9.2.148_cudnn7.6.2_0" \
    45      "torchvision=0.4.0=py36_cu92" \
    46   && conda clean -ya
    47  
    48  # Install HDF5 Python bindings
    49  RUN conda install -y h5py=2.8.0 \
    50   && conda clean -ya
    51  RUN pip install h5py-cache==1.0
    52  
    53  # Install Torchnet, a high-level framework for PyTorch
    54  RUN pip install torchnet==0.0.4