nvcr.io/nvidia/tensorflow:18.11-py3 to custom conda python 3.5

Pre:

  • download Anaconda3 distribution (Anaconda3-5.3.0-Linux-x86_64.sh in this example)
  • create .condarc (see below)
  • create jupyter_notebook_config.py (see below)

.condarc :

channel_priority: True

channels:
  - conda-forge
  - defaults
  - intel

jupyter_notebook_config.py :

c.NotebookApp.ip = '0.0.0.0'
c.NotebookApp.open_browser = False
c.NotebookApp.password = 'sha1: xxxxxxxxx'
# to generate: from notebook.auth import passwd; passwd()
c.NotebookApp.port = 8888

Dockerfile:

FROM nvcr.io/nvidia/tensorflow:18.11-py3

MAINTAINER MyName <my@email.dom>
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
COPY	./Anaconda3-5.3.0-Linux-x86_64.sh /root/anaconda.sh
ENV	PATH="/opt/conda/bin:$PATH"

RUN 	apt-get update && \
	apt-get install -y libgtk2.0 libgl1-mesa-dev libgl1-mesa-dri libgl1-mesa-glx && \
	apt-get purge && \
	apt-get clean

RUN	/bin/bash /root/anaconda.sh -b -p /opt/conda && \
	rm /root/anaconda.sh && \
	rm /usr/bin/python && \
	ln -s /usr/bin/python3.5 /usr/bin/python

COPY    ./.condarc /root/.condarc

COPY	./jupyter_notebook_config.py /root/.jupyter/

VOLUME [ "/app", "/data" ]
EXPOSE 8888

ENTRYPOINT [ "/usr/local/bin/nvidia_entrypoint.sh" ]

WORKDIR /app

CMD ["bash"]

build image (1st approach)

# docker build . -t myrepo/myimg_name:tag01

run container:

# nvidia-docker run -it --rm myrepo/myimg_name:tag01

inside container: 

# conda install python=3.5 scikit-image imageio hyperopt basemap basemap-data-hires opencv pyarrow shapely numpy=1.14
# conda install pydot graphviz netcdf4