Skip to content
A starting point for your custom Dockerfile that works on binder. You probably don't want to use this.
Dockerfile
Branch: master
Clone or download
minrk Merge pull request #2 from betatim/betatim-patch-1
Switch USER at the end to not run as root
Latest commit 9bd912f Mar 1, 2019

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Dockerfile Switch USER at the end to not run as root Feb 28, 2019
LICENSE public domain license for examples Sep 20, 2018
README.md typos in README Sep 20, 2018

README.md

Minimal Dockerfiles for Binder

Binder

Binder needs only one thing for images to work:

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

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

RUN pip install --no-cache notebook

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.7-slim
RUN pip install --no-cache notebook
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.

You can’t perform that action at this time.