Build image:
vanillin DOCKER_IMAGE_NAME
Run JupyterLab:
vanillin DOCKER_IMAGE_NAME 10000
Don't have vanillin
installed? Add as an oh-my-zsh
plugin here
Build image:
docker build --rm -t DOCKER_IMAGE_NAME .
Run JupyterLab:
docker run --rm -p 10000:8888 -e JUPYTER_ENABLE_LAB=yes -v $PWD:/home/jovyan/work DOCKER_IMAGE_NAME
Don't have Docker installed? Download here
Get coding using community Jupyter containers ("regular cola", π) just the way you like 'em ("vanilla cola", π€©).
A plugin for oh-my-zsh and A repo template: makes it easier to work with Jupyter Docker containers, simplifying commands and providing a simple project template.
Using oh-my-zsh, add vanillin as a plugin. Makes it easier to build/run project docker containers for JupyterLab.
- Follow along below
- Or here's a direct link to the
vanillin.plugin.zsh
file
Run this code in Terminal:
mkdir $ZSH_CUSTOM/plugins/vanillin
wget -O $ZSH_CUSTOM/plugins/vanillin/vanillin.plugin.zsh https://gist.githubusercontent.com/zachbogart/c01e88886855c39c4058d0baa43ec9ec/raw/vanillin.plugin.zsh
Open ~/.zshrc
and add vanillin as a plugin. With comments, probably looks something like:
# Which plugins would you like to load?
# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git vanillin)
Update:
source ~/.zshrc
- Uses this Gist to create vanillin alias
π¦ -- Example --
π¦
π¦ Build `cool_image_name` from pwd Dockerfile
π¦ and run JupyterLab on the result, on port 10000
π¦
π¦ 1. `vanillin cool_image_name`
π¦ 2. `vanillin cool_image_name 10000`
Type vanillin
for usage:
π¦
π¦ Vanillin: alias for docker build/run JupyterLab commands
π¦ - GitHub: https://github.com/zachbogart/vanillin
π¦
π¦ Usage:
π¦
π¦ vanillin name
π¦ Alias for: `docker build --rm -t name .`
π¦ - Shorthand for building image from pwd Dockerfile
π¦
π¦ vanillin name port
π¦ Alias for: `docker run --rm -p port:8888 -e JUPYTER_ENABLE_LAB=yes -v $PWD:/home/jovyan/work name`
π¦ - Shorthand for running JupyterLab
π¦
π¦ -- Example --
π¦
π¦ Build `cool_image_name` from pwd Dockerfile
π¦ and run JupyterLab on the result, on port 10000
π¦
π¦ 1. `vanillin cool_image_name`
π¦ 2. `vanillin cool_image_name 10000`
π¦
Can use this repo as a template for a new project. Simply:
- Rename/Find & Replace
DOCKER_IMAGE_NAME
at the top to specify how you want to title your local images for this project - Remove Doc info from this README (info after first line break)
- Ready to Go!
A template for making projects that use Jupyter Docker Images to run JupyterLab and an alias for zsh to make it easier to build/run the images.
Process
- Template has Dockerfile, builds off of Jupyter Docker Stacks base images, adding anything specified for custom build
- Run new image, accessing JupyterLab
- Includes nice alias function to avoid having to type really long docker commands
- Depend on Docker: Much less hassle regarding dependencies. Just specify a base image and go
- Easy to customize: add a
pip install
orinstall.packages
to Dockerfile asRUN
commands, and can tailor image to project-specific needs - Easy to share: Dockerfile describes dependencies, can run/work in same environment
- R and Python at once: Go back and forth between R/Python in same Jupyter Environment with something like jupyter-datascience-notebook
This command is explained in the Jupyter Docker Stacks Quickstart, Example 3
- Installs using Jupyter Community Docker images can be large (2-4 GB). First install may take a few minutes, but using the same base image across different projects will reduce any instances of large install wait times (Docker will use cached base image). So don't get scared downloading a big base image: reuse it and every project afterwards will be speedy to build.
- Jupyter Docker Stacks: Main documentation for "ready-to-run Docker images containing Jupyter applications and interactive computing tools". This explains all the ins-and-outs regarding the image setup, versioning schema, setting up additional features, etc.
- Image Selection: All docker images from Jupyter available on DockerHub, used as starting point for this repo. Can easily find image by filtering for given type, links to DockerHub.
Made with π