Giter VIP home page Giter VIP logo

repo2docker-minimal-dockerfile's Introduction

Minimal Dockerfiles for Binder

Binder

Binder needs only one thing for images to work:

  • to be able to launch jupyter notebook with jupyterlab as a specified user (passed via docker build args as NB_UID/NB_USER)

What this means in practice is that the notebook and jupyterlab packages must be installed and on PATH:

RUN pip install --no-cache notebook jupyterlab

Note that if you are not installing jupyterlab in addition to the classic notebook, you'll need to change your mybinder.org URLs from /lab to /tree as described here. Otherwise, you might get a "404: Not Found" error when launching your project on binder. Now that's almost everything.

The remaining piece is that the specified user must be able to start the notebook, which requires certain permissions like being able to write to the home directory.

The absolute bare minimum for this is to set HOME to /tmp so that it's writable, which would make the shortest, smallest Dockerfile that works on Binder:

FROM python:3.9-slim
RUN pip install --no-cache notebook jupyterlab
ENV HOME=/tmp

which you can try out: Binder

However, it would be better to consume the NB_UID/NB_USER arguments and create a real user:

# create user with a home directory
ARG NB_USER
ARG NB_UID
ENV USER ${NB_USER}
ENV HOME /home/${NB_USER}

RUN adduser --disabled-password \
    --gecos "Default user" \
    --uid ${NB_UID} \
    ${NB_USER}
WORKDIR ${HOME}

From this point, you can start adding files, installing packages, etc.

repo2docker-minimal-dockerfile's People

Contributors

minrk avatar n-coder avatar sd109 avatar betatim 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.