How to use a lightweight docker image on the nano

Good day,

i want to create a docker image that should combine the use of dash and tensorflow-gpu. At the moment my docker image has the size of about ~3.2GB. Is it possible to use a minimal ubuntu image or even alpine to decrease the overall size?

at the moment my Dockerfile looks like this

FROM nvcr.io/nvidia/l4t-base:r32.2
WORKDIR /
RUN apt-get update && apt-get install -y python3-pip libatlas-base-dev
ADD wheels /wheels
ADD req /req
RUN pip3 install --find-links=/wheels -r /req/requirements
ADD src /src
RUN rm -rf /wheels
CMD ( "python3" "./src/app.py" )

I just need python3 but numpy raises an error because I need libcblas.so.3

Is it possible to use a more lightweight image?

Sincerely, gdest

Hi,

Would you mind to share the file list in the /wheels folder with us?
In general, you will need l4t-image, cuda, cuDNN and TensorRT to make TensorFlow work.

Thanks.

Thanks for your answer AastaLLL

absl_py-0.8.0-py3-none-any.whl
astor-0.8.0-py2.py3-none-any.whl
certifi-2019.6.16-py2.py3-none-any.whl
chardet-3.0.4-py2.py3-none-any.whl
Click-7.0-py2.py3-none-any.whl
dash-1.2.0-py3-none-any.whl
dash_core_components-1.1.2-py3-none-any.whl
dash_html_components-1.0.1-py3-none-any.whl
dash_renderer-1.0.1-py3-none-any.whl
dash_table-4.2.0-py3-none-any.whl
Flask-1.1.1-py2.py3-none-any.whl
Flask_Compress-1.4.0-py3-none-any.whl
future-0.17.1-py3-none-any.whl
gast-0.2.2-py3-none-any.whl
google_pasta-0.1.7-py3-none-any.whl
grpcio-1.23.0-cp36-cp36m-linux_aarch64.whl
h5py-2.9.0-cp36-cp36m-linux_aarch64.whl
idna-2.8-py2.py3-none-any.whl
itsdangerous-1.1.0-py2.py3-none-any.whl
Jinja2-2.10.1-py2.py3-none-any.whl
Keras-2.2.5-py2.py3-none-any.whl
Keras_Applications-1.0.8-py3-none-any.whl
Keras_Preprocessing-1.1.0-py2.py3-none-any.whl
Markdown-3.1.1-py2.py3-none-any.whl
MarkupSafe-1.1.1-cp36-cp36m-linux_aarch64.whl
mock-3.0.5-py2.py3-none-any.whl
numpy-1.17.1-cp36-cp36m-linux_aarch64.whl
pandas-0.25.1-cp36-cp36m-linux_aarch64.whl
pbr-5.4.2-py2.py3-none-any.whl
plotly-4.1.0-py2.py3-none-any.whl
portpicker-1.3.1-py3-none-any.whl
protobuf-3.9.1-py2.py3-none-any.whl
psutil-5.6.3-cp36-cp36m-linux_aarch64.whl
py_cpuinfo-5.0.0-py3-none-any.whl
python_dateutil-2.8.0-py2.py3-none-any.whl
pytz-2019.2-py2.py3-none-any.whl
PyYAML-5.1.2-cp36-cp36m-linux_aarch64.whl
requests-2.22.0-py2.py3-none-any.whl
retrying-1.3.3-py3-none-any.whl
scipy-1.3.1-cp36-cp36m-linux_aarch64.whl
setuptools-41.2.0-py2.py3-none-any.whl
six-1.12.0-py2.py3-none-any.whl
tensorboard-1.14.0-py3-none-any.whl
tensorflow_estimator-1.14.0-py2.py3-none-any.whl
tensorflow_gpu-1.14.0+nv19.7-cp36-cp36m-linux_aarch64.whl
termcolor-1.1.0-py3-none-any.whl
testresources-2.0.1-py2.py3-none-any.whl
urllib3-1.25.3-py2.py3-none-any.whl
Werkzeug-0.15.5-py2.py3-none-any.whl
wheel-0.33.6-py2.py3-none-any.whl
wrapt-1.11.2-cp36-cp36m-linux_aarch64.whl

this is my wheel folder with a size of around 341mb. I delete the folder later after the installation of these wheels. I still cant get under 3.2Gb. My goal would be around 2.5Gb so the Nano can handle it good enough. Maybe you have a tip.

sincerely

gdest

Hi,

There are lots of packages you have installed.
Is there any package can be removed? Ex.tensorboard.

Thanks.

Tensorboard is also installed when I want to install Keras. I have another solution for now :

-Concat the RUN Commands from multiple RUN statements to only one
-docker squash helps a lot as well. This will purge the wheel folder

Thank you for your information and help!

Edit: Just want to add my changes for other people. These should be self-describing.

FROM nvcr.io/nvidia/l4t-base:r32.2
WORKDIR /app
COPY qemu-aarch64-static /usr/bin
ADD . /app
RUN apt-get update && apt-get install --no-install-recommends -y python3-pip libatlas-base-dev && apt-get clean && apt-get autoclean && rm -rf /var/lib/apt/lists/* && \
    pip3 install --no-cache-dir --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v42 --find-links=/app/wheels -U -r requirements  && \
    rm -rf /app/wheels

Image size went from 3.2Gb to 2.5Gb only with structural changes.

Good to know this.
Thanks for the sharing : )