My dockerfile is from https://github.com/pytorch/pytorch/commit/4dbeb87e52982c2e1aecf901e6742fb9eb64c9c7#diff-305c1a8c354e4056b2827374b606efd0 18 https://github.com/pytorch/pytorch/blob/master/docker/pytorch/Dockerfile 11
I changed cuda version 10.0 to 9.0
here is my Dockerfile:
FROM nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04
ARG PYTHON_VERSION=3.6
RUN apt-get update && apt-get install -y --no-install-recommends \
         build-essential \
         cmake \
         git \
         curl \
         ca-certificates \
         libjpeg-dev \
         libpng-dev && \
     rm -rf /var/lib/apt/lists/*


RUN curl -o ~/miniconda.sh -O  https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh  && \
     chmod +x ~/miniconda.sh && \
     ~/miniconda.sh -b -p /opt/conda && \
     rm ~/miniconda.sh && \
     /opt/conda/bin/conda install -y python=$PYTHON_VERSION numpy pyyaml scipy ipython mkl mkl-include ninja cython typing && \
     /opt/conda/bin/conda install -y -c pytorch magma-cuda100 && \
     /opt/conda/bin/conda clean -ya
ENV PATH /opt/conda/bin:$PATH
# This must be done before pip so that requirements.txt is available
WORKDIR /opt/pytorch
COPY . .

RUN git submodule update --init --recursive
RUN TORCH_CUDA_ARCH_LIST="3.5 5.2 6.0 6.1 7.0+PTX" TORCH_NVCC_FLAGS="-Xfatbin -compress-all" \
    CMAKE_PREFIX_PATH="$(dirname $(which conda))/../" \
    pip install -v .

RUN git clone https://github.com/pytorch/vision.git && cd vision && pip install -v .

WORKDIR /workspace
RUN chmod -R a+w .

I executed docker build, and I got this:
Sending build context to Docker daemon  3.072kB
Step 1/13 : FROM nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04
 ---> afc5ab1e9a0d
Step 2/13 : ARG PYTHON_VERSION=3.6
 ---> Using cache
 ---> 956aaeb0f1b7
Step 3/13 : RUN apt-get update && apt-get install -y --no-install-recommends          build-essential          cmake          git          curl          ca-certificates          libjpeg-dev          libpng-dev &&      rm -rf /var/lib/apt/lists/*
 ---> Using cache
 ---> e18e7fec7691
Step 4/13 : RUN curl -o ~/miniconda.sh -O  https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh  &&      chmod +x ~/miniconda.sh &&      ~/miniconda.sh -b -p /opt/conda &&      rm ~/miniconda.sh &&      /opt/conda/bin/conda install -y python=$PYTHON_VERSION numpy pyyaml scipy ipython mkl mkl-include ninja cython typing &&      /opt/conda/bin/conda install -y -c pytorch magma-cuda100 &&      /opt/conda/bin/conda clean -ya
 ---> Using cache
 ---> 121b8d486e0b
Step 5/13 : ENV PATH /opt/conda/bin:$PATH
 ---> Using cache
 ---> 4f8332eed85b
Step 6/13 : WORKDIR /opt/pytorch
 ---> Using cache
 ---> 249592e692ad
Step 7/13 : COPY . .
 ---> a248c8bc4865
Step 8/13 : RUN ls
 ---> Running in 9dc1ca1e2c9f
Dockerfile
Removing intermediate container 9dc1ca1e2c9f
 ---> 0600255e2c98
Step 9/13 : RUN git submodule update --init --recursive
 ---> Running in 8c683be2721a
fatal: Not a git repository (or any of the parent directories): .git