---------------
failure
---------------
$ git clone https://github.com/tensorflow/tensorflow.git
$ cd tensorflow
$ git checkout r1.15
$ docker pull tensorflow/tensorflow:devel-gpu-py3
$ docker run --gpus all -it -w /tensorflow -v $PWD:/mnt -e HOST_PERMS="$(id -u):$(id -g)" tensorflow/tensorflow:devel-gpu-py3 bash
// Take note of your Docker version with docker -v. Versions earlier than 19.03 require nvidia-docker2 and the --runtime=nvidia flag.
// On versions including and after 19.03, you will use the nvidia-container-toolkit package and the --gpus all flag.
// in Docker container:
# ./configure
// defaults for all
# gcc --version
gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// since Tensorflow version is less than 2.0, attach --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0"
# bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0"
...
ERROR: An error occurred during the fetch of repository 'gast_archive':
// use latest Tensorflow 2.0 instead of 1.15
---------------
success
---------------
$ git clone https://github.com/tensorflow/tensorflow.git
$ cd tensorflow
$ docker pull tensorflow/tensorflow:devel-gpu-py3
$ docker run --gpus all -it -w /tensorflow -v $PWD:/tensorflow -e HOST_PERMS="$(id -u):$(id -g)" tensorflow/tensorflow:devel-gpu-py3 bash
// Take note of your Docker version with docker -v. Versions earlier than 19.03 require nvidia-docker2 and the --runtime=nvidia flag.
// On versions including and after 19.03, you will use the nvidia-container-toolkit package and the --gpus all flag.
// in Docker container:
# ./configure
// defaults for all
# bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package
...
INFO: Elapsed time: 11871.027s, Critical Path: 548.92s
INFO: 26894 processes: 26894 local.
INFO: Build completed successfully, 36933 total actions
# mkdir target
# ./bazel-bin/tensorflow/tools/pip_package/build_pip_package /tensorflow/target
# chown $HOST_PERMS /tensorflow/target/tensorflow-2.0.0-cp36-cp36m-linux_x86_64.whl
# pip uninstall tensorflow
WARNING: Skipping tensorflow as it is not installed.
# pip install /tensorflow/target/tensorflow-2.0.0-cp36-cp36m-linux_x86_64.whl
# cd /tmp
// don't import from source directory
# python -c "import tensorflow as tf; print(tf.__version__)"
2.0.0
# exit
$ docker ps -a
$ docker commit container-ID sytf20s
// sytf20s is a name selected by me
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
sytf20s latest 52ce2bc5925a 18 minutes ago 27.7GB