Skip to content

Instantly share code, notes, and snippets.

@uchilaka
Last active September 27, 2020 15:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uchilaka/9fa59fbc007b5ee04da4f84771a98d09 to your computer and use it in GitHub Desktop.
Save uchilaka/9fa59fbc007b5ee04da4f84771a98d09 to your computer and use it in GitHub Desktop.
Jupyter Base Notebook with Docker for Mac

Running Jupyter Notebook with Docker

It's super easy. A few useful guides:

Useful Guides

  1. Getting started with Docker Desktop (for Mac): https://www.docker.com/docker-desktop/getting-started-for-mac
  2. Getting started with Docker Compose: https://docs.docker.com/compose/gettingstarted/

Useful Docker Compose Commands

# cd into the directory where you have your docker-compose.yml script

# 1. stand up your environment
docker-compose up -d

# 2. view your (jupyter) credentials
docker-compose logs
docker-compose logs <service-name>

# 3. stop your environments
docker-compose stop <service-name>

# 4. nuke your environment(s)
docker-compose down
# put this file at the root of a folder for your dockerized jupyter environment
version: "3.6"
services:
jupyter-base: # service name
image: jupyter/base-notebook
container_name: python_scratch # use this with docker commands. E.g. docker start python_scratch
restart: unless-stopped # makes it so your container starts with docker
ports:
- 8888:8888 # this is how you "hit" your app in your browser
environment:
JUPYTER_ENABLE_LAB: "yes" # these are environment variables
volumes:
- ./work:/home/jovyan/work # this maps directories on your host machine to a path in the container
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment