Prerequisites

In this article we will learn how to install and run TensorFlow using Docker on Ubuntu 20.04 . It is presumed that the server has Docker install and docker daemon is running.



TensorFlow as a container 


For this TensorFlow deployment on Bamboo B1000N we do not have an official docker image which supports the ARM64 platform, so we will be using a public image for our deployment.




Firstly create a container with this image by using the following command:

docker run -u $(id -u):$(id -g) -it  flodutot/tensorflow_aarch64:cpu-jupyter-latest bash 
Bash
 
  • run is the command to create a new container
  • -it specifies to run the container in an interactive mode with tty terminal
  • flodutot/tensorflow_aarch64:cpu-jupyter-latest is the name of the image on dockerhub (we downloaded this before with the pull command, but Docker will do this automatically if the image is missing)
  • bash - to invoke the bash shell when you get the container prompt



You should see something similar to the output shown below:

Bash
 
________ _______________ ___ __/__________________________________ ____/__ /________ __ __ / _ _ \_ __ \_ ___/ __ \_ ___/_ /_ __ /_ __ \_ | /| / / _ / / __/ / / /(__ )/ /_/ / / _ __/ _ / / /_/ /_ |/ |/ / /_/ \___//_/ /_//____/ \____//_/ /_/ /_/ \____/____/|__/ You are running this container as user with ID 999 and group 999, which should map to the ID and group for your user on the Docker host. Great! tf-docker /tf >


Verify that the container will run:

python3
import tensorflow as tf 
Bash
 

You should see something similar to the output shown below:

Output
tf-docker /tf > python3 Python 3.8.5 (default, Jul 28 2020, 12:59:40) [GCC 9.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import tensorflow as tf >>>