Skip to content

illinois-mla/phys-398-mla-image

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHYS 398 MLA Docker Image

Docker image for the PHYS 398 MLA used to power the PrairieLearn workspaces.

Docker Images Docker Pulls Docker Image Size (tag)

Installation

docker pull physicsillinois/phys-398-mla:latest

Spring 2022

Use the spring-2022 tag of the Docker image

docker pull physicsillinois/phys-398-mla:spring-2022

Use

To run the Docker image as a container with persistence of any files that are generated in the environment, you can bind mount your current working directory to the working directory inside of the container and expose the port 8080

docker run --rm -ti -v $PWD:/home/jovyan/work -w /home/jovyan/work -p 8080:8080 physicsillinois/phys-398-mla:spring-2022

this will then start a JupyterLab server instance, which you can open up on your local browser by visiting the url http://localhost:8080/lab.

Any files that exist in your current working directory will be available inside of the Docker image in your JupyterLab environment, and any files you create inside the JupyterLab environment will be saved in your current working directory.

Optional easy way

If you want to use a simple Bash script that will do this for you, you can first just download the run_jupyter_standalone.sh script from this repo with something like

curl -sLO https://raw.githubusercontent.com/illinois-mla/phys-398-mla-image/main/run_jupyter_standalone.sh

and then run it from the directory with your notebook you'd like to run

bash run_jupyter_standalone.sh

Interactive Jupyter widgets

The image has support for Jupyter widgets enabled, like ipympl, that allow for interactive elements to be used.

Simple Example

Enable ipympl for interactive matplotlib visualizations in your Jupyter notebook

%matplotlib widget  # Enable matplotlib Jupyter widget

import numpy as np
import matplotlib.pyplot as plt

x = np.linspace(0, 10, 1000)
y = np.sin(x)

fig, ax = plt.subplots()
ax.plot(x, y)