TensorFlow : Install Docker Image (CPU)2020/07/24 |
Install TensorFlow which is the Machine Learning Library.
On this example, Install TensorFlow official Docker Image without GPU support and run it on Containers.
|
|
[1] | |
[2] | Install TensorFlow Docker (CPU only). |
# pull TensorFlow 2.0 with Python3 image [cent@dlp ~]$ docker pull tensorflow/tensorflow:2.0.0-py3
docker images REPOSITORY TAG IMAGE ID CREATED SIZE tensorflow/tensorflow 2.0.0-py3 90f5cb97b18f 9 months ago 1.07GB # run container [cent@dlp ~]$ docker run --rm tensorflow/tensorflow:2.0.0-py3 \ python -c "import tensorflow as tf; print(tf.reduce_sum(tf.random.normal([1000, 1000])))" 2020-07-23 22:08:51.520138: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2801845000 Hz 2020-07-23 22:08:51.520702: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x37ec9f0 executing computations on platform Host. Devices: 2020-07-23 22:08:51.523989: I tensorflow/compiler/xla/service/service.cc:175] StreamExecutor device (0): Host, Default Version tf.Tensor(1521.4528, shape=(), dtype=float32) import tensorflow as tf hello = tf.constant('Hello, TensorFlow World!') tf.print(hello) docker run --rm -v $PWD:/tmp -w /tmp tensorflow/tensorflow:2.0.0-py3 python ./hello_tensorflow.py 2020-07-23 22:10:02.484191: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2801845000 Hz 2020-07-23 22:10:02.486266: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x38f12a0 executing computations on platform Host. Devices: 2020-07-23 22:10:02.486299: I tensorflow/compiler/xla/service/service.cc:175] StreamExecutor device (0): Host, Default Version Hello, TensorFlow World! |
[3] | Install TensorFlow Docker Image with Jupyter Notebook. |
# pull TensorFlow 2.0 with Python3/Jupyter image [cent@dlp ~]$ docker pull tensorflow/tensorflow:2.0.0-py3-jupyter
docker images REPOSITORY TAG IMAGE ID CREATED SIZE tensorflow/tensorflow 2.0.0-py3-jupyter c652a4fc8a4f 9 months ago 1.22GB tensorflow/tensorflow 2.0.0-py3 90f5cb97b18f 9 months ago 1.07GB # run container as daemon [cent@dlp ~]$ docker run -dt -p 8888:8888 tensorflow/tensorflow:2.0.0-py3-jupyter 4b65c77143ea83773db64031dc73eddb8b31c71c74e3506b700aaa3a523af9b5[cent@dlp ~]$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 4b65c77143ea tensorflow/tensorflow:2.0.0-py3-jupyter "bash -c 'source /et…" 38 seconds ago Up 37 seconds 0.0.0.0:8888->8888/tcp suspicious_easley # confirm URL [cent@dlp ~]$ docker exec 4b65c77143ea bash -c "jupyter notebook list" Currently running servers: http://0.0.0.0:8888/?token=7357a472cdce008e59298c69b20731f1f6ed0bc3f8529a8f :: /tf |
Accessto the URL above, then it's possible to use Jupyter Notebook. |
Sponsored Link |