Building the Containers#

Note

See the Glossary for the meaning of the acronyms used in this guide.

You will need to build several container images using the Dockerfiles in the Dioptra GitHub repository before you can run Dioptra for the first time. This guide will walk you through the steps for building these images.

To begin, open a Terminal and clone the GitHub repository if you have not already done so.

git clone https://github.com/usnistgov/dioptra.git
git clone git@github.com:usnistgov/dioptra.git

Optionally, if you want to build the latest versions of the containers, you should first switch to the dev branch.

# OPTIONAL: switch to the dev branch to get the latest container images
git checkout -b dev origin/dev

Next, if you have extra CA certificates that you want to include during the build process, copy them into the docker/ca-certificates/ folder. This is something you may need to do if you are building the containers in a corporate environment that has its own certificate authority. See the docker/ca-certificates/README.md file for additional information.

Next, use the Makefile to build the container images.

# NOTE: if make cannot find your python executable, you can specify it manually by
#       prepending PY=/path/to/python3 to the command below
# NOTE: the PyTorch and Tensorflow images may take a while to build
make build-nginx build-mlflow-tracking build-restapi build-pytorch-cpu build-tensorflow-cpu

If you are running Dioptra on a host machine that has one or more CUDA-compatible GPUs, then it is recommended that you also build the GPU-enabled images:

# NOTE: the PyTorch and Tensorflow images may take a while to build
make build-pytorch-gpu build-tensorflow-gpu

Finally, run docker images to verify that the container images are now available with the dev tag. You should see output that looks like the following,

REPOSITORY                           TAG       IMAGE ID       CREATED         SIZE
dioptra/nginx                        dev       17235f76d81c   3 weeks ago     243MB
dioptra/restapi                      dev       f7e59af397ae   3 weeks ago     1.16GB
dioptra/mlflow-tracking              dev       56c574822dad   3 weeks ago     1.04GB
dioptra/pytorch-cpu                  dev       5309d66defd5   3 weeks ago     3.74GB
dioptra/tensorflow2-cpu              dev       13c4784dd4f0   3 weeks ago     3.73GB

Your REPOSITORY and TAG columns should match up with the above list.