Play with the SPT3G software suit on any operating system within an isolated Docker container. This repository was created to enable users to prototype and run spt3g code to a limited extent on local machines especially when access to the internet may be limited. This container is built on ubuntu:20.04 with python:3.8.10 and comes with:
- Full SPT3G software environment
- Jupyter and IPython
- Local copy of spt3g_software documentation
Install the appropriate version of Docker for your operating system : https://docs.docker.com/engine/install
We can then build the docker image using the provieded Dockerfile
:
git clone git@github.com:amanchokshi/spt3g-docker.git cd spt3g-docker # Copy or clone the spt3g_software repo here # Need to be a part of the SPT3G Colab for this git clone git@github.com:SouthPoleTelescope/spt3g_software.git # Build the image with any tag [-t] docker build . -t achokshi/spt3g
Create a directory to mount to the docker container. Once mounted it will be available to your host computer and within the docker container, serving as a location to put data and save outputs to:
mkdir ~/spt3g-docker
Run the container with:
docker run --rm -it \ -v ~/spt3g-docker:/root/spt3g-docker \ -p 8888:8888 -p 3141:3141 \ --hostname spt3g \ achokshi/spt3g
The --rm
flag shuts down and cleans up the running container once you're done, while the -it
flag provides an interactive terminal. The -v --volume
flag mounts the local ~/spt3g-docker
volume to the corresponding /root/spt3g-docker
directory within the
docker container. The -p
or flag publishes the container's port(s) to the host. Port 8888
is dedicated for Jupyter
while port
3141
is reserved to host a local copy of spt3g_software
documentation. achokshi/spt3g
is the tag of the docker image which we pulled in
previous steps. If the image runs succesfully you will see:
############################################## Welcome to the SPT3G Docker Container SPT3G Environment Variables Set SPT3G Docs Availabel at http://localhost:3141 ############################################## root@spt3g:~#
Files which you put within ~/spt3g-docker
will now be available to you. A local version of the documentation is available at http://localhost:3141
once the above commands have been succesfully executed.
Jupyter notebooks are a common tool for interactive data analysis and can be run from this container with:
jupyter-lab --port=8888 --no-browser --ip=0.0.0.0 --allow-root
Any notebooks or data you create will be saved in your ~/spt-docker
directory and be available after the container is shutdown.
You should run tests to see that nothing broke in the build:
root@spt3g:~# cd spt3g_software/ root@spt3g:~/spt3g_software# cd build/ root@spt3g:~/spt3g_software/build# make test Running tests... .. .. 100% tests passed, 0 tests failed out of 54
Hooray!!