aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/tools/docker/README.md
blob: e94b11e4f2fd8fd7921c2c8ef8db75df03eda1d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Using TensorFlow via Docker

This directory contains `Dockerfile`s to make it easy to get up and running with
TensorFlow via [Docker](http://www.docker.com/).

## Installing Docker

General installation instructions are
[on the Docker site](https://docs.docker.com/installation/), but we give some
quick links here:

* [OSX](https://docs.docker.com/installation/mac/): [docker toolbox](https://www.docker.com/toolbox)
* [ubuntu](https://docs.docker.com/installation/ubuntulinux/)

## Which containers exist?

We currently maintain three Docker container images:

* `b.gcr.io/tensorflow/tensorflow`, which is a minimal VM with TensorFlow and
  all dependencies.

* `b.gcr.io/tensorflow/tensorflow-full`, which contains a full source
  distribution and all required libraries to build and run TensorFlow from
  source.

* `b.gcr.io/tensorflow/tensorflow-full-gpu`, which is the same as the previous
  container, but built with GPU support.

## Running the container

Each of the containers is published to a Docker registry; for the non-GPU
containers, running is as simple as

    $ docker run -it -p 8888:8888 b.gcr.io/tensorflow/tensorflow

For the container with GPU support, we require the user to make the appropriate
NVidia libraries available on their system, as well as providing mappings so
that the container can see the host's GPU. For most purposes, this can be
accomplished via

    $ export CUDA_SO=$(\ls /usr/lib/x86_64-linux-gnu/libcuda* | xargs -I{} echo '-v {}:{}')
    $ export DEVICES=$(\ls /dev/nvidia* | xargs -I{} echo '--device {}:{}')
    $ docker run -it -p 8888:8888 $CUDA_SO $DEVICES b.gcr.io/tensorflow/tensorflow-devel-gpu

Alternately, you can use the `docker_run_gpu.sh` script in this directory.

## Rebuilding the containers

Just pick the dockerfile corresponding to the container you want to build, and run;

    $ docker build -t $USER/tensorflow-suffix -f Dockerfile.suffix .