I’m trying to create a docker container that has some of the packages already inst

The problem is that the Dockerfile(s) created by the Jupyter project use USER root, which causes COPY and RUN to execute as different users in this Dockerfile.

(base) jovyan@c10d47473a48:~$ ls -l
total 8
-rw-r--r-- 1 root   root    63 Jan 31 14:03 Project.toml
drwsrwsr-x 2 jovyan users 4096 Jan 28 16:43 work
(base) jovyan@c10d47473a48:~$ whoami
jovyan

This Dockerfile works:

FROM jupyter/datascience-notebook:latest
WORKDIR /home/jovyan
USER root
COPY Project.toml .
RUN julia --project -e "using Pkg; Pkg.instantiate();"
RUN julia -e "using Pkg; Pkg.status()"

The notebook is not run as root due to start-notebook.sh.

3 Likes