Running jupyter/tensorflow-notebook works fine until I try to bind the home-directory.
docker run --name jupyter \
--publish 4000:8888 \
--volume /root/docker/jupyter:/home/jovyan \
jupyter/tensorflow-notebook start-notebook.sh \
--NotebookApp.password='sha1:XXXXXXX...' \
--NotebookApp.allow_origin='*' \
--log-level DEBUG
It fails with
container_linux.go:247: starting container process caused "chdir to cwd (\"/home/jovyan/work\") set in config.json failed: no such file or directory"
docker: Error response from daemon: invalid header field value "oci runtime error: container_linux.go:247: starting container process caused \"chdir to cwd (\\\"/home/jovyan/work\\\") set in config.json failed: no such file or directory\"\n".
When I create /root/docker/jupyter/work, I get a permission error:
PermissionError: [Errno 13] Permission denied: '/home/jovyan/.jupyter'
So after using chown 1000:1000 -R /root/docker/jupyter, the notebook finally starts. However, and here's the catch, connections to it from outside of the docker container get aborted immediately. I thought initially that it would be an error in my docker configuration, see my question on StackOverflow.
TLDR; it works without --volume, it doesn't work with --volume. Note that I don't even see any output from the container about something trying to connect to the container when I try to access it from the outside.
Mounting over the entire jovyan home directory is not supported as there are config files in there that get masked. Try mounting to /home/jovyan/work instead.
If you really need files in the root of your home you'll need to replicate what already exists in the image in your host directory.
Thanks, that worked. I'm sure why though, docker copies files from a directory that is being replaced by a binding automatically, thus already existing configuration files should automatically be copied from the image to the volume at /root/docker/jupyter. If the files don't already exist in the image and are created at a later point, they would just be created in the volume. Do I get something wrong?
Anyway, now I have a different problem that the notebook can't connect to the kernels or terminals don't connect (page just stays empty besides the Jupyter header). I think it's not related directly, only to Docker, so I might just create a new issue.
I'm sure why though, docker copies files from a directory that is being replaced by a binding automatically
When you use the -v to mount from a host, docker doesn't make any copies. It simply masks any existing directory at the mount target with the one from the host.
Anyway, now I have a different problem that the notebook can't connect to the kernels or terminals don't connect
Feel free to open a separate issue if your debugging leads you to believe it's related to docker somehow.
How to login into docker container by root user. I tried below but i am getting below error.
Can anyone suggest here
[user@hostname ~]$ docker exec -it --user root f296ce6cf879 /bin/bash
OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused "chdir to cwd (\"/u01/oracle\") set in config.json failed: permission denied": unknown
How to login into docker container by root user. I tried below but i am getting below error.
Can anyone suggest here
[user@hostname ~]$ docker exec -it --user root f296ce6cf879 /bin/bash
OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused "chdir to cwd ("/u01/oracle") set in config.json failed: permission denied": unknown
https://github.com/oracle/docker-images/issues/1336#issuecomment-530789709
Most helpful comment
Mounting over the entire jovyan home directory is not supported as there are config files in there that get masked. Try mounting to /home/jovyan/work instead.
If you really need files in the root of your home you'll need to replicate what already exists in the image in your host directory.