GithubHelp home page GithubHelp logo

egf_docker_jupyter's Introduction

EGF + Docker + Jupyter

version

Docker Jupyter images with (almost) all EGF packages for running them in a Jupyter notebook.

TLDR

Build the EGF image locally, in the directory of the cloned repo:

docker build --tag egf-notebook .

To run the image, switch to a working directory, then:

docker run --rm -p 8888:8888 --name egf-container -e JUPYTER_ENABLE_LAB=yes -e NB_UID=1000 \
    -e NB_GID=1000 -e CHOWN_HOME=yes -e CHOWN_EXTRA_OPTS='-R' --user root -w /home/jovyan/ \
    -v /path/to/notebooks/on/host:/home/jovyan/ egf-notebook
  • Change NB_UID and NB_GID values to your user and group ids. You can obtain them with cat /etc/passwd (on Ubuntu);
  • Change /path/to/notebooks/on/host/ to your local working directory.

Environment variable JUPYTER_ENABLE_LAB=yes is set in accordance with recommendations. Other options used here:

-e, --env list               Set environment variables
--name string                Assign a name to the container
-p, --publish list           Publish a container's port(s) to the host
--rm                         Automatically remove the container when it exits
-u, --user string            Username or UID (format: <name|uid>[:<group|gid>])
-w, --workdir string         Working directory inside the container
-v, --volume list            Bind mount a volume

See details here for EGF staff members.


Details

The github actions workflow creates an egf-notebook image and uploads privately to ghcr.io.

The Dockerfile builds from a base-notebook image, based on jupyter/base-notebook, and installs EGF packages as listed in requirements.txt, in the way advised here.

See instructions here for building with a custom base-notebook, or using image files on hard disk.

You can list images with docker image ls. By default, the notebooks and the work are not saved in the host filesystem, therefore we run the notebook image with a couple of options that bind mount a directory on the filesystem, and set proper access permissions so that it will remain editable by both Docker (Jupyter) and the OS user.

Introduction to Docker

Install Docker, then try a Jupyter notebook image.

1. Install Docker

Ubuntu: https://docs.docker.com/engine/install/ubuntu/

Mac OS: https://docs.docker.com/docker-for-mac/install/

2. Try a Jupyter notebook image

Run the below in a terminal. Pull a standard Jupyter notebook image:

docker pull jupyter/base-notebook

Run the image:

docker run -p 8888:8888 jupyter/base-notebook

This will create a container from the image and start it. Argument -p publishes a container's port(s) to the host. You can access the running Jupyter in your browser with the link provided in the output of this command. Check that it works.

Using image files on hard disk

Save: docker save egf-notebook:latest | gzip > egfnotebook_latest.tar.gz

Load:

gunzip egfnotebook_latest.tar.gz
docker image load --input egfnotebook_latest.tar

egf_docker_jupyter's People

Contributors

veghp avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.