gnu-octave / docker

Docker images of GNU Octave.
GNU General Public License v3.0
35 stars 5 forks source link

jupyterlab/Dockerfile - permission problem of $HOME/.jupyter #2

Closed kolbma closed 2 years ago

kolbma commented 3 years ago

I'm using the latest docker hub jupyterlab-tag of today.

https://github.com/gnu-octave/docker/blob/main/jupyterlab/Dockerfile

After some usage and trying container restart I got a permission problem...

Executing the command: jupyter lab
Traceback (most recent call last):
  File "/usr/local/bin/jupyter-lab", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/dist-packages/jupyter_server/extension/application.py", line 526, in launch_instance
    serverapp = cls.initialize_server(argv=args)
  File "/usr/local/lib/python3.8/dist-packages/jupyter_server/extension/application.py", line 496, in initialize_server
    serverapp.initialize(
  File "/usr/local/lib/python3.8/dist-packages/traitlets/config/application.py", line 88, in inner
    return method(app, *args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/jupyter_server/serverapp.py", line 2054, in initialize
    super(ServerApp, self).initialize(argv=argv)
  File "/usr/local/lib/python3.8/dist-packages/traitlets/config/application.py", line 88, in inner
    return method(app, *args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/jupyter_core/application.py", line 229, in initialize
    self.migrate_config()
  File "/usr/local/lib/python3.8/dist-packages/jupyter_core/application.py", line 155, in migrate_config
    migrate()
  File "/usr/local/lib/python3.8/dist-packages/jupyter_core/migrate.py", line 245, in migrate
    with open(os.path.join(env['jupyter_config'], 'migrated'), 'w') as f:
PermissionError: [Errno 13] Permission denied: '/home/jovyan/.jupyter/migrated'

There is also this problem in log:

[W 2021-09-12 18:10:12.959 ServerApp] 500 PUT /lab/api/workspaces/default?1631470212934 (192.168.3.213): [Errno 13] Permission denied: '/home/jovyan/.jupyter/lab'
[W 2021-09-12 18:10:12.960 LabApp] [Errno 13] Permission denied: '/home/jovyan/.jupyter/lab'

The directory $HOME/.jupyter has been created with

drwx--S--- 2 root   users 4096 Sep  1 05:55 .jupyter

So I'm not sure how I got in the state, that the container doesn't start with the first log output, but I think this directory should be owned by ${NB_USER}.

siko1056 commented 3 years ago

Thank you very much for your detailed report.

To reproduce the issue, it would be helpful to know, how (with which command) the container was started? :slightly_smiling_face:

Do you use the install.sh script and the automatically created desktop icon to start JupyterLab as described in https://github.com/gnu-octave/docker#easy-installation ?

kolbma commented 3 years ago

Hi, I've installed via network in a remote docker daemon, so no install.sh...

docker pull gnuoctave/octave:jupyterlab
docker run -d --name octave_jupyterlab -p 8888:8888 gnuoctave/octave:jupyterlab

So default entrypoint of the image.

siko1056 commented 3 years ago

Thank you for the information @kolbma . I think to have identified the culprit by comparing with the upstream Docker image, which did not have the permission problem. In short, I seemed to have run

jupyter notebook --generate-config

as "root" and not as default user "jovyan" during the image build.

Currently, I rebuild the images with GitHub Actions and in about 3 hours hopefully fixed images should be pushed to Dockerhub.

Again thank you for the report and please give a short feedback if that change solved the issue :slightly_smiling_face:

siko1056 commented 3 years ago

Sorry, due to GitHub Action errors the rebuild of the images took a little longer. Now with a fresh image, the whole home directory belongs to the default "jovyan" (uid 1111) user and the error should be gone.

Again thank you for the report and please give a short feedback if that change solved the issue :slightly_smiling_face:

kolbma commented 3 years ago

@siko1056 Hello Kai, yes it works here now. Thanks for your quick fix.

benymahajan commented 2 years ago

Hi @siko1056 , I spin up a docker image provide aws-glue using below docker run command:   _docker run --platform linux/amd64  -it -p 8888:8888 -p 4040:4040 -e DISABLE_SSL="true" -v ~/.aws:/root/.aws:ro --name glue_jupyter amazon/aws-glue-libs:glue_libs_3.0.0_image_01 /home/glue_user/jupyter/jupyterstart.sh

Everytime stop this container, i get error similar to what @kolbma has shown: image

Can you help me out as well, i always loose my saved work on the Image.

siko1056 commented 2 years ago

Hi @benymahajan,

Thank you for your report. I do not fully understand what you are trying to start. It looks like you are using docker.io/gnuoctave/octave:jupyterlab but I do not see this in you command. What is "aws-glue" and what is the script /home/glue_user/jupyter/jupyter_start.sh?

Due to how the used JupyterLab base image is working, the following options should be provided to give the start.sh script the necessary permissions to change the home user directory permissions

           --env="NB_USER=$USER" \
           --env="NB_UID=$(id -u)" \
           --env="NB_GID=$(id -g)" \
           --env="GRANT_SUDO=yes" \
           --user root \
benymahajan commented 2 years ago

Hi @siko1056 , I am using AWS Documentation to spin up AWS Glue (ETL tool) on a docker container and to be able to write code in Jupyter. below is the documentation i am following. https://aws.amazon.com/blogs/big-data/develop-and-test-aws-glue-version-3-0-jobs-locally-using-a-docker-container/

siko1056 commented 2 years ago

@benymahajan Can you explain how you combined the docker.io/amazon/aws-glue-libs:glue_libs_3.0.0_image_01 and docker.io/gnuoctave/octave:jupyterlab images? I have no idea how to follow the tutorial given in the link above using the Docker solution provided by this repository :thinking:

Radhika-s-r commented 2 years ago

https://medium.com/@radhi9214/getting-started-with-a-glue-spark-environment-locally-with-jupyter-notebook-and-docker-82fe73e9fa13.

Try referring the page

siko1056 commented 2 years ago

Thanks for your article. However, it does not describe, how both Docker images get combined 🤔