标签:user ext erp ips uninstall fss cte _id asi
Docker is the best platform to easily install Tensorflow with a GPU. Here, I want to record What I did to set up tensorflow-gpu with docker on my ubuntu 18.04 LTS.
The steps are
Type the following commands to install proper nvidia driver.
sudo apt update
sudo ubuntu-drivers autoinstall
sudo reboot
When it works well, then reboot machine. If it successfully reboots, open a terminal and use command nvidia-smi
. If it properly shows you the status of Nvidia GPU like below, then it‘s already properly installed.
Old version of Docker were call docker
or docker-engine
. If are installed, uninstall them:
sudo apt-get remove docker docker-engine docker.io
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
, by searching for the last 8 characters of the fingerprint.sudo apt-key fingerprint 0EBFCD88
Use the following command to set up the stable repository
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install docker-ce
# If you have nvidia-docker 1.0 installed: we need to remove it and all existing GPU containers
docker volume ls -q -f driver=nvidia-docker | xargs -r -I{} -n1 docker ps -q -a -f volume={} | xargs -r docker rm -f
sudo apt-get purge -y nvidia-docker
# Add the package repositories
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
sudo apt-get update
# Install nvidia-docker2 and reload the Docker daemon configuration
sudo apt-get install -y nvidia-docker2
sudo pkill -SIGHUP dockerd
# Test nvidia-smi with the latest official CUDA image
docker run --runtime=nvidia --rm nvidia/cuda:9.0-base nvidia-smi
TensorFlow‘s many tags are defined on GitHub, where you can also find extra Dockerfiles. See the full list of tags for the available images.
1.xx-
, latest-
, and nightly-
tags come with TensorFlow pre-numbered and latest- images contain the latest release, and the nightly images come with the latest TensorFlow nightly Python package.devel
images come with Bazel and are ideal for developing changes to TensorFlow (they don‘t have TensorFlow installed, however). /tensorflow_src
includes the TensorFlow source tree at a recent known-to-compile commit.custom-op
is a special experimental image for developing TF custom ops.-py3
images come with Python 3.5 instead of Python 2.7.-gpu
tags are based on Nvidia CUDA. You need nvidia-docker to run them.-jupyter
tags include Jupyter and some TensorFlow tutorial notebooks.. They start a Jupyter notebook server on boot. Mount a volume to /tf/notebooks
to work on your own notebooks.Choose your favorite version image by tag
docker pull tensorflow/tensorflow:latest-gpu-py3
options explain
-v
: mount/home/user/notebooks
to/root/notebooks
on container.
docker run -it --rm --runtime=nvidia -v /home/user/notebooks:/root/notebooks tensorflow/tensorflow:latest-gpu-py3 /bin/bash
Modify image base on tensorflow/tensorflow
# enter container
docker run -it tensorflow/tensorflow /bin/bash
# install vim on container
apt install vim
If it work well, then type ctrl+p
and then type ctrl+q
to return ubuntu system but container still running.
Save modify
# list running container and get container id
docker ps
# copy modified container named container-name
# if container-name equal to current container name, it‘s overwrite;
# else it‘s copy and save as a new container
docker commit <container-id> <container-name>
Set up Tensorflow-gpu with Docker on Ubuntu 18.04 LTS
标签:user ext erp ips uninstall fss cte _id asi
原文地址:https://www.cnblogs.com/ychuch/p/10215184.html