Consider alternative docker image atttribute as kernel_id
First of all great work of yours! appreciate it.
Though I met some problems when trying to install a docker image as a KernelSpec (tensorflow/tensorflow:latest-gpu to be precise).
got an Error
ValueError: kernelspec already exists: /home/lubricy/.local/share/jupyter/kernels
it turns out that image.attrs['ContainerConfig']['Hostname'] is just an empty string.
I'm not quite familiar with docker image attrs but perhaps a sanitized image tag (e.g. tensorflow_tensorflow_latest-gpu)would work better here? or perhaps rather let user to decide the name/id of there kernel?
Another unrelated thing is I think it would be nice if dockernel start (and dockernel install) could accept docker cli flags (e.g. -v VOLUME , -p PORT, -u USER etc.). a particular flag I'd like to use is --gpus all but it seems like it's not natively supported by py-docker upstream. Maybe give python-on-whales a try?
Hi @Lubricy! Thank you, I'm glad you like it!
I had no idea that ['Hostname'] key could point to an empty string there. At the very least that's something that needs to be shielded against.
Looking back at it, I'm not sure whether it was a good idea to use Hostname there at all. IIRC this was just a temporary bodge, so that I don't have to look after something more proper to put there. I'll surely need to add an --id argument into dockernel install so that even if it bites, its workaround-able.
I plan on putting some of the container configuration into a per-user setting, so that e.g. you can specify the volumes you work on inside a ~/.dockernel config file and use them for every kernel. That topic is still very much open, so if you have any suggestions - I'd love to hear them.
With regards to --gpus all - I'll have to look into it. Are you sure it's not supported? Looks to me like it was merged last year via docker/docker-py#2471, I'll have to check.
Note to self:
- docker/docker-py#2395
- docker/docker-py#2462
- docker/docker-py#2471 (PR)
took a second look on the PR - yeah you are right it's supported. I got confused by those still-open issues.