manics
January 27, 2025, 4:22pm
2
You’ve switched to USER root
at the start which means all your RUN
commands will create root owned files/directories. Try switching back to USER ${NB_UID}
before running any commands that affect the home directory, or alternatively there’s a fix-permissions "/home/${NB_USER}"
script you can run, for example:
# Sometimes, when the new version of `jupyterlab` is released, latest `notebook` might not support it for some time
# Old versions of `notebook` (<v7) didn't have a restriction on the `jupyterlab` version, and old `notebook` is getting installed
# That's why we have to pin the minimum notebook version
# More info: https://github.com/jupyter/docker-stacks/pull/2167
'notebook>=7.2.2' && \
jupyter server --generate-config && \
mamba clean --all -f -y && \
jupyter lab clean && \
rm -rf "/home/${NB_USER}/.cache/yarn" && \
fix-permissions "${CONDA_DIR}" && \
fix-permissions "/home/${NB_USER}"
ENV JUPYTER_PORT=8888
EXPOSE $JUPYTER_PORT
# Configure container startup
CMD ["start-notebook.py"]
# Copy local files as late as possible to avoid cache busting
COPY start-notebook.py start-notebook.sh start-singleuser.py start-singleuser.sh /usr/local/bin/
COPY jupyter_server_config.py docker_healthcheck.py /etc/jupyter/
3 Likes