Custom Search

Wednesday, May 24, 2017

How to Install TensorFlow with Docker on Ubuntu 17.04 16.04

https://docs.docker.com/engine/installation/linux/ubuntu/

1)
Uninstall old versions of Docker
Older versions of Docker were called docker or docker-engine. If these are installed, uninstall them:

$ sudo apt-get remove docker docker-engine

2)
Install packages to allow apt to use a repository over HTTPS:

$sudo apt-get update

$ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common

3)
Add Docker’s official GPG key:

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

4)
Verify that the key fingerprint is 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88.
$ sudo apt-key fingerprint 0EBFCD88

5)
Use the following command to set up the stable docker ubuntu repository.

$ sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

6)
Install Docker
Update the apt package index.
$ sudo apt-get update

7)
Install the latest version of Docker.
$ sudo apt-get install docker-ce

OR

Install a specific version of Docker.
$ sudo apt-get install docker-ce=

8)
Verify that Docker CE.
$ sudo docker run hello-world

This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.
Docker is installed and running. You need to use sudo to run Docker commands.

9)
Following command launches the latest TensorFlow CPU binary image in a Docker container from which you can run TensorFlow programs in a shell:

$ docker run -it gcr.io/tensorflow/tensorflow bash


10)
Validate your installation.

Run a short TensorFlow program

Invoke python from your shell as follows:

$ python

Enter the following short program inside the python interactive shell:

import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))