Skip to content

Commit 27080da

Browse files
Merge pull request #437 from supertetelman/ngc-dockerfiles
Add Example NGC Dockerfiles
2 parents 2ca9687 + ff80d86 commit 27080da

File tree

4 files changed

+137
-0
lines changed

4 files changed

+137
-0
lines changed

containers/ngc/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# NGC-based Docker Containers
2+
3+
This directory contains several Dockerfiles for common Deep Learning and Machine Learning frameworks. These serve as an example for extending NGC Docker images.
4+
5+
By default, most NGC containers start a shell prompt. These Dockerfiles are designed to start JupyterLab by default, allowing for easier integration into interactive notebook platforms such as Kubeflow.
6+
7+
They also build ontop of the base NGC containers by including additional packages for demos, monitoring, generating graphs, Kubernetes integration, and rendering interactive html5 elements.
8+
9+
Where possible, the package versions in these Dockerfiles are hard-coded to ensure repeatable builds.
10+
11+
Additional details about NGC can be found [here](http://ngc.nvidia.com/).
12+
13+
## Misc. Notes
14+
15+
* JupyterLab is exposed at port 8888
16+
* Tensorboard is exposed at port 6006
17+
* The `WORKDIR` contains the built-in NGC tutorials and example code. This is /workspace in most cases.
18+
19+
## Included Frameworks
20+
21+
* PyTorch
22+
* TensorFlow
23+
* RAPIDS

containers/ngc/pytorch/Dockerfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# https://ngc.nvidia.com/catalog/containers/nvidia:pytorch
2+
FROM nvcr.io/nvidia/pytorch:20.01-py3
3+
4+
# Install some extra packages to ease development
5+
RUN apt-get update && \
6+
apt-get install -y screen unzip git vim htop font-manager && \
7+
rm -rf /var/lib/apt/*
8+
9+
# Install nodejs, it is a dependency for Jupyter labextensions
10+
RUN conda install nodejs=10.13.0 && conda clean -yac *
11+
12+
# Install the NVIDIA Jupyter Dashboard
13+
RUN conda install -y -c conda-forge jupyterlab-nvdashboard==0.1.11 && conda clean -yac * && \
14+
jupyter labextension install jupyterlab-nvdashboard
15+
16+
# Install ipyvolume for clean HTML5 visualizations
17+
RUN conda install -y -c conda-forge ipyvolume==0.5.2 && conda clean -yac * && \
18+
jupyter labextension install ipyvolume
19+
20+
# Install graphviz for clean graph/node/edge rendering
21+
RUN conda install -c conda-forge python-graphviz=0.13.2 graphviz=2.42.3 && conda clean -yac *
22+
23+
# Expose Jupyter & Tensorboard
24+
EXPOSE 8888
25+
EXPOSE 6006
26+
27+
# /workspace contains NVIDIA tutorials and example code
28+
WORKDIR /workspace
29+
30+
# Start Jupyter up by default rather than a shell
31+
ENTRYPOINT ["/bin/sh"]
32+
CMD ["-c", "jupyter lab --notebook-dir=/workspace --ip=0.0.0.0 --no-browser --allow-root --port=8888 --NotebookApp.token='' --NotebookApp.password='' --NotebookApp.allow_origin='*' --NotebookApp.base_url=${NB_PREFIX}"]

containers/ngc/rapids/Dockerfile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# https://ngc.nvidia.com/catalog/containers/nvidia:rapidsai:rapidsai
2+
FROM nvcr.io/nvidia/rapidsai/rapidsai:cuda10.1-runtime-ubuntu18.04
3+
4+
# RAPIDS is installed using conda and we need to work from this environment
5+
ENV CONDA_ENV rapids
6+
7+
# Install some extra packages to ease development
8+
RUN source activate ${CONDA_ENV} && \
9+
apt-get update && \
10+
apt-get install -y screen unzip git vim htop font-manager && \
11+
rm -rf /var/lib/apt/*
12+
13+
# Install the NVIDIA Jupyter Dashboard
14+
RUN source activate ${CONDA_ENV} && \
15+
conda install -y -c conda-forge jupyterlab-nvdashboard==0.1.11 && conda clean -yac * && \
16+
jupyter labextension install jupyterlab-nvdashboard
17+
18+
# Install ipyvolume for clean HTML5 visualizations
19+
RUN source activate ${CONDA_ENV} && \
20+
conda install -y -c conda-forge ipyvolume==0.5.2 && conda clean -yac * && \
21+
jupyter labextension install ipyvolume
22+
23+
# Install graphviz for clean graph/node/edge rendering
24+
RUN source activate ${CONDA_ENV} && \
25+
conda install -c conda-forge python-graphviz=0.13.2 graphviz=2.42.3 && conda clean -yac *
26+
27+
# Install dask_kubernetes for deploying works through K8S and monitoring through Jupyter
28+
RUN source activate ${CONDA_ENV} && \
29+
conda install -c conda-forge dask-kubernetes==0.10.1 && conda clean -yac *
30+
31+
# Expose Jupyter and Dask ports
32+
EXPOSE 8888
33+
EXPOSE 8787
34+
35+
# /rapids contains NVIDIA & contrib tutorials and example code
36+
WORKDIR /rapids
37+
38+
# Start using the built in RAPIDS conda environment
39+
ENTRYPOINT ["/bin/sh"]
40+
CMD ["-c", "/opt/conda/envs/${CONDA_ENV}/bin/jupyter lab --notebook-dir=/rapids --ip=0.0.0.0 --no-browser --allow-root --port=8888 --NotebookApp.token='' --NotebookApp.password='' --NotebookApp.allow_origin='*' --NotebookApp.base_url=${NB_PREFIX}"]

containers/ngc/tensorflow/Dockerfile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# https://ngc.nvidia.com/catalog/containers/nvidia:tensorflow
2+
FROM nvcr.io/nvidia/tensorflow:20.01-tf1-py3
3+
4+
# Install some extra packages to ease development
5+
RUN apt-get update && \
6+
apt-get install -y screen unzip git vim htop font-manager && \
7+
rm -rf /var/lib/apt/*
8+
9+
# Install nodejs and npm, which are dependencies for labextensions
10+
RUN apt-get update && \
11+
apt-get install -y nodejs=8.10.0~dfsg-2ubuntu0.4 \
12+
npm=3.5.2-0ubuntu4 && \
13+
rm -rf /var/lib/apt/*
14+
15+
# Cleanup old python2 install that interferes with pip
16+
RUN rm /usr/bin/python && \
17+
ln -s $(which python3) /usr/bin/python
18+
19+
# Install the NVIDIA Jupyter Dashboard
20+
RUN pip install jupyterlab-nvdashboard==0.2.0 && \
21+
jupyter labextension install jupyterlab-nvdashboard
22+
23+
# Install ipyvolume for clean HTML5 visualizations
24+
RUN pip install ipyvolume==0.5.2 && \
25+
jupyter labextension install ipyvolume
26+
27+
# Install graphviz for clean graph/node/edge rendering
28+
RUN apt-get update && \
29+
apt-get install -s graphviz=2.40.1-2 && \
30+
pip install graphviz==0.13.2 && \
31+
rm -rf /var/lib/apt/*
32+
33+
# Expose Jupyter & Tensorboard
34+
EXPOSE 8888
35+
EXPOSE 6006
36+
37+
# /workspace contains NVIDIA tutorials and example code
38+
WORKDIR /workspace
39+
40+
# Start Jupyter up by default rather than a shell
41+
ENTRYPOINT ["/bin/sh"]
42+
CMD ["-c", "jupyter lab --notebook-dir=/workspace --ip=0.0.0.0 --no-browser --allow-root --port=8888 --NotebookApp.token='' --NotebookApp.password='' --NotebookApp.allow_origin='*' --NotebookApp.base_url=${NB_PREFIX}"]

0 commit comments

Comments
 (0)