I am trying to build a GPU-enabled Docker image for my ML application, but I have some fairly strict requirements:
tensorflow==2.13
python>=3.10,<3.12
The tensorflow/tensorflow:2.13.0-gpu image on Docker hub is based on Ubuntu 20.04 so use a quite old Python 3.8.
There is also tensorflow/build:2.13-python3.11 that technically works great, but is a whopping 11GB. I guess I am hoping to get an image closer to the 6.6GB that tensorflow/tensorflow:2.13.0-gpu
clocks in at, but with a newer Python. (I acknowledge even this is huge, and most of that is from GPU support)
Is there an extant public (and trusted) Docker image that meets my needs?
Otherwise I could try to build my own. In this case I would like to replicate and slightly modify the same build behind tensorflow/tensorflow:2.13.0-gpu
, but I am not sure where that lives. (It did not have luck just reproducing the commands shown in docker history
.) Where is the Dockerfile (or build script) for the official tensorflow/tensorflow:2.13-gpu Docker image?
I found the code to build tensorflow/tensorflow
runtime images here: https://github.com/tensorflow/build/tree/fdd023e/tensorflow_runtime_dockerfiles
I was able to successfully build a new image with my own choice of Python version and Tensorflow as follows:
docker build -f gpu.Dockerfile --target=base --build-arg="TENSORFLOW_PACKAGE=tensorflow~=2.13.0" . -t tensorflow/custom-runtime:2.13-python3.11