I'm having trouble getting Jupyter to run on rootless Docker due to permission problems. Here's my docker-compose.yml configuration:
```
name: jupyter
services:
jupyter:
image: jupyter/base-notebook:latest
container_name: jupyter
restart: unless-stopped
networks:
- services
environment:
- JUPYTER_ENABLE_LAB=yes
volumes:
- ./data/jupyter/kb:/home/jovyan/work
- ./config:/home/jovyan/.jupyter
networks:
services:
external: true
```
The directories `./data` and `./config` have permissions set to 755 and files to 644, all owned by me. I've attempted running the container with the same user ID as the one reported by the container but that didn't resolve the issue. Any suggestions would be appreciated!
2 Answers
I found a workaround that might help. You could create a directory that is writable for everyone, start the container, create the necessary files inside as the 'www-data' user, and then check the ownership from your host system. After that, you can adjust the ownership on the host as needed.
To resolve the permission issues, ensure you're running the container with the same user ID as your local user. This way, that user can access and modify the files without any ownership conflicts. Make sure that the user in the container also owns the files you're trying to access.
Thanks! Could you explain how to change the user ID in the Docker setup?

Be careful with that approach! If you run as root, the files created will end up being owned by root. It’s better to avoid running as root to prevent constant permission issues.