1.create container
docker run --name tf12 -it ubuntu /bin/bash
2.install anaconda
[260254@localhost download]$ sudo docker cp Anaconda3-5.3.1-Linux-x86_64.sh 0d5:/root
root@0d580c903134:/# bash Anaconda3-5.3.1-Linux-x86_64.sh
3.inquire gpu
[260254@localhost ~]$ lspci | grep -i vga
01:00.0 VGA compatible controller: NVIDIA Corporation GM107GL [Quadro K620] (rev a2)
[260254@localhost ~]$ lspci -v -s 01:00.0
01:00.0 VGA compatible controller: NVIDIA Corporation GM107GL [Quadro K620] (rev a2) (prog-if 00 [VGA controller])
Subsystem: NVIDIA Corporation Device 1098
Physical Slot: 1
Flags: bus master, fast devsel, latency 0, IRQ 125
Memory at de000000 (32-bit, non-prefetchable) [size=16M]
Memory at c0000000 (64-bit, prefetchable) [size=256M]
Memory at d0000000 (64-bit, prefetchable) [size=32M]
I/O ports at e000 [size=128]
Expansion ROM at df000000 [disabled] [size=512K]
Capabilities: <access denied>
Kernel driver in use: nouveau
Kernel modules: nouveau
4.install cuda(cudnn)
root@0d580c903134:~# apt-get update && apt-get install wget -y --no-install-recommends
root@0d580c903134:~# wget "http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb"
root@0d580c903134:~# dpkg -i cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
root@0d580c903134:~# apt-get install gnupg
root@0d580c903134:~# apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
root@0d580c903134:~# apt-get update
root@0d580c903134:~# CUDNN_URL="http://developer.download.nvidia.com/compute/redist/cudnn/v7.4/cudnn-10.0-linux-x64-v7.4.2.24.tgz"
root@0d580c903134:~# wget ${CUDNN_URL}
root@0d580c903134:~# tar -xzf cudnn-10.0-linux-x64-v7.4.2.24.tgz -C /usr/local
root@0d580c903134:~# rm cudnn-10.0-linux-x64-v7.4.2.24.tgz && ldconfig
5.install tensorflow
root@0d580c903134:~# pip install tensorflow-gpu