Docker enables you to create "containers" which provide consistent environments in which to run your code. This way, you can run the software you write on different machines (e.g. your laptop vs the computing cluster) without having to spend too much time worrying about adapting it.
We're going to just be using some very basic features of Docker, so if you'd like to learn more refer to this page.
Detailed installation instructions are available here. For our purposes, you can simply:
Download the installer.
Double click on the installer and follow the prompts (keeping all options as defaults is fine).
Open a shell (e.g.
cmd.exe) and trying running the test example:docker run hello-world
Detailed installation instructions are available here. Be warned, however, that some people at IHME with older Lenovo laptops have had trouble getting them to work.
Detailed installation instructions are available here. For our purposes, you can simply:
Download the installer.
Double click on the installer and drag
Docker.appinto your Applications folder.Double click on
Docker.appto start Docker.Open a shell (e.g.
terminal.app) and trying running the test example:docker run hello-world
¯\_(ツ)_/¯
Anaconda is a software package for Python (and R and sometimes C...) that handles the installation of common Python packages for you, making it easier to create and manage portable environments. We'll be using it inside of Docker to ensure that everyone is running under the same environment. See this page for more on how Docker and Anaconda fit together.
Get the latest Anaconda for Python 3 image:
docker pull continuumio/anaconda3
Test that your installation worked:
docker run continuumio/anaconda3 /opt/conda/bin/conda info
You can fire up a notebook using the following command:
docker run -it -p 8888:8888 -v ~/repos/ihme-python-course/:/home/ihme-python-course/ continuumio/anaconda3 /opt/conda/bin/jupyter notebook --ip='*' --no-browser --notebook-dir=/home/ihme-python-course/
What do all of these arguments mean?
Argument
Value
Description
-itRun the Docker container interactively
-p8888:8888Map the 8888 port of the Docker container to the local port so that you can connect to it via your web browser
-v~/repos/ihme-python-course/:/home/ihme-python-course/Maps
<host directory>:<container directory>so that the repo you've downloaded is visible to the containercontinuumio/anaconda3The name of the Docker container to be run
/opt/conda/bin/jupyterThe program to execute inside of the container (Jupyter)
notebookThis tells Jupyter to start a Notebook server
--ip'*'Configures Jupyter to respond to any user that can connect to the container
--no-browserPrevents Jupyter from trying to automatically launch a web browser, since the Docker container does not have one
--notebook-dir/home/ihme-python-course/Sets the root directory for the Jupyter server to the same one mapped under
-vIf you've followed all of the directions above exactly, you shouldn't need to edit any of these right now. If you've saved into a non-standard location, you may need to change the first part of your
-vargument.There are many more options you can specify. See the corresponding Docker and Jupyter documentation.
Navigate to localhost:8888 in your web browser. You should see a listing of the files and directories inside this repo.