dockernel
dockernel copied to clipboard
Cannot install example dockerfile
I am unable to install any docker images as jupyter kernels. All attempts end with ValueError: kernelspec already exists: /Users/ben/Library/Jupyter/kernels.
.
Steps to reproduce:
- Create
Dockerfile
with contents from https://github.com/MrMino/dockernel/blob/master/example_dockerfile - Run the following:
docker build --tag dockerneltest .
pip install dockernel
dockernel install dockerneltest
Results:
Traceback (most recent call last):
File "/Users/ben/opt/anaconda3/bin/dockernel", line 8, in <module>
sys.exit(main())
File "/Users/ben/opt/anaconda3/lib/python3.7/site-packages/dockernel/__main__.py", line 6, in main
return run(sys.argv)
File "/Users/ben/opt/anaconda3/lib/python3.7/site-packages/dockernel/app.py", line 7, in run
return run_subcommand(parsed_args)
File "/Users/ben/opt/anaconda3/lib/python3.7/site-packages/dockernel/cli/main.py", line 23, in run_subcommand
return parsed_args.func(parsed_args)
File "/Users/ben/opt/anaconda3/lib/python3.7/site-packages/dockernel/cli/install.py", line 77, in install
install_kernelspec(location, kernelspec)
File "/Users/ben/opt/anaconda3/lib/python3.7/site-packages/dockernel/kernelspec.py", line 163, in install_kernelspec
raise ValueError(f"kernelspec already exists: {kernelspec_dir}.")
ValueError: kernelspec already exists: /Users/ben/Library/Jupyter/kernels.
Huh, that's weird. The kernel should install into .../kernels/{kernel_id}
. May I know which version of dockernel and which OS are you using?
Got the same problem. I'm using Docker version 20.10.8.
I believe this is relevant: https://github.com/docker/cli/issues/2868#issuecomment-741774889
When using the new buildkit the ContainerConfig is empty, so https://github.com/MrMino/dockernel/blob/master/dockernel/cli/install.py#L59 returns an empty string.
A workaround is to build the image with env DOCKER_BUILDKIT=0 docker build xxxx
.
Maybe use image id or the first repo tag as kernel_id instead?
@akialbz yes, that might be it. I need to dive deeper into it (and it won't happen sooner than December), but if someone wants to fix this - PRs welcome.