b-data / jupyterlab-python-docker-stack

(GPU accelerated) Multi-arch (linux/amd64, linux/arm64/v8) JupyterLab Python docker images. Please submit Pull Requests to the GitLab repository. Mirror of
https://gitlab.com/b-data/jupyterlab/python/docker-stack
Other
31 stars 6 forks source link

Mounting volume to a directory in $NB_USER breaks init.sh #1

Closed njacobson-nci closed 9 months ago

njacobson-nci commented 1 year ago

It appears that mounting a volume to $NB_USER/work will cause a failure in before-notebook.d init.sh.

The only change between these two commands is the volume mounting location inside the container. I removed everything except the bare minimum from the commands I'm running to see what causes the failure. Even explicitly setting the workdir to /home/njacobson or /home/jovyan fails.

It's not an unworkable issue, but it is strange and it's not specific to the work/ folder name. Figure it's worth documenting at least so others don't have to debug it.

Love the repo though, really great work.

docker run --gpus all -it -p 8888:8888 --user root -e NB_USER="njacobson" -v /home/nvadmin/data:/home/njacobson/work/ jupyterlab/cuda/python/scipy:latest
Entered start.sh with args: jupyter lab
/usr/local/bin/start.sh: running hooks in /usr/local/bin/start-notebook.d as uid / gid: 0 / 0
/usr/local/bin/start.sh: running script /usr/local/bin/start-notebook.d/populate.sh
/usr/local/bin/start.sh: done running hooks in /usr/local/bin/start-notebook.d
Updated the jovyan user:
- username: jovyan       -> njacobson
- home dir: /home/jovyan -> /home/njacobson
Ensuring /home/njacobson is owned by 1000:100 
/usr/local/bin/start.sh: running hooks in /usr/local/bin/before-notebook.d as uid / gid: 0 / 0
/usr/local/bin/start.sh: running script /usr/local/bin/before-notebook.d/init.sh
mv: cannot stat '.local/share/code-server/User/settings.json': No such file or directory
docker run --gpus all -it -p 8888:8888 --user root -e NB_USER="njacobson" -v /home/nvadmin/data:/home/njacobson/ jupyterlab/cuda/python/scipy:latest
Entered start.sh with args: jupyter lab
/usr/local/bin/start.sh: running hooks in /usr/local/bin/start-notebook.d as uid / gid: 0 / 0
/usr/local/bin/start.sh: running script /usr/local/bin/start-notebook.d/populate.sh
/usr/local/bin/start.sh: done running hooks in /usr/local/bin/start-notebook.d
Updated the jovyan user:
- username: jovyan       -> njacobson
- home dir: /home/jovyan -> /home/njacobson
Populating home dir /home/njacobson...
Success!
Ensuring /home/njacobson is owned by 1000:100 
/usr/local/bin/start.sh: running hooks in /usr/local/bin/before-notebook.d as uid / gid: 0 / 0
/usr/local/bin/start.sh: running script /usr/local/bin/before-notebook.d/init.sh
/usr/local/bin/start.sh: done running hooks in /usr/local/bin/before-notebook.d
Running as njacobson: jupyter lab
....
benz0li commented 1 year ago

It appears that mounting a volume to $NB_USER/work will cause a failure in before-notebook.d init.sh.

If "${NB_USER}" != "jovyan", any folder mounted in "/home/${NB_USER}" will prevent the startup from succeeding.

👉 This is because of https://github.com/b-data/jupyterlab-python-docker-stack/blob/35b38bc63d3920e204200ad07eace6c39d2b5934/base/scripts/usr/local/bin/start.sh#L128

The bind mounted home directory is only populated if it is empty.

benz0li commented 1 year ago

That's one of many reasons why I'm building my own Jupyter docker stack incorporating the changes listed above and mounting the entire home directory.

https://github.com/jupyter/docker-stacks/issues/1478

benz0li commented 1 year ago

Figure it's worth documenting at least so others don't have to debug it.

Will do.

njacobson-nci commented 1 year ago

That also precludes having any data in the host mounting location as well. Is the solution to mount a working directory to another location?

benz0li commented 1 year ago

That also precludes having any data in the host mounting location as well.

Correct. Bind mounting is only supported for empty folders.

Is the solution to mount a working directory to another location?

I suggest mounting any other [host] folder as a subfolder of /mnt in the container.
ℹ️ Filesystem Hierarchy Standard > ... > 3.12. /mnt : Mount point for a temporarily mounted filesystem

benz0li commented 1 year ago

I had the following in mind:

[^1]: An exception may be made for small sample data sets.

benz0li commented 1 year ago

@njacobson-nci Is https://github.com/b-data/jupyterlab-python-docker-stack/blob/main/CUDA.md#run-container OK?

If yes, please close this issue.

njacobson-nci commented 1 year ago

Yeah thanks for documenting that!

benz0li commented 9 months ago

Bind mounting a subfolder of the home directory is only possible for images with Python version ≥ 3.12.2.