Using Docker Image (under development) - ComputeCanada/ahep_interactive_analysis_facility GitHub Wiki
Base docker commands
To create a container from an image (i.e tejinc/dune_iaf:jupyterhub-dev
) with interactive bash access, one can do
docker run -it --rm --name jupyter-server tejinc/dune_iaf:jupyterhub-dev /bin/bash
This tells docker
that the container is interactive (-i
) and connect to stdin/stdout through pseudo-TTY (-t
). --rm
tells docker to delete container upon exit, leave this option out if you want the container to be persistent. --name NAME
gives the container a specific name, docker will assign a random name if no one is specified. The options are followed by the image name and the command to run with the image (/bin/bash
)
This command will create a container out of tejinc/dune_iaf:jupyterhub-dev
, in a SL7 bash environment with ROOT, MAT, miniconda3, and coffea. One could install new software the same way on his/her own computer (using yum
of course).
We could also mount cvmfs
if the local machine has access to it. Just add the following option --volume /cvmfs/:/cvmfs/:shared
in the docker run command.
docker run -it --rm --name jupyter-server --volume /cvmfs/:/cvmfs/:shared tejinc/dune_iaf:jupyterhub-dev /bin/bash
Run Jupyterhub server
We can run a Jupyterhub server using the docker image by
docker run -it --rm --name jupyter-server -p 8000:8000 tejinc/dune_iaf:jupyterhub-dev /bin/bash -c jupyterhub
Note that -p H:D
tells docker to publish docker port D
to host port H
. The addition of -c jupyterhub
tells bash to run the command jupyterhub
.
Jupyterhub configuration file
jupyterhub --generate-config
will create a default config file. The config file tells Jupyterhub how to work, i.e. authenticate users, spawn servers, which IP and port to connect, etc.