I have a JupyerHub installation on a Debian host [1] and a docker installed on a CentOS host [2]. What I would like to do is that JupyterHub loads its containers from the docker host, not from the docker from the JupyterHub instance. My configuration is in [3]. The host name was changed on purpose.
My docker context is properly pointing to the remote host and all related commands work on the remote host [4].
But whenever Jupyter tries to start a container for a logged user, I get the error on [5].
What I am missing? Thank you!
[1]
root@jupyterhub:/etc/jupyterhub# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye
[2]
[root@docker]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
We set it up as you suggested [1]. We tried with both SSH and TCP, but both returned the same error [2]. We also uninstalled docker from our JupyterHub host just to make sure it wasnât interfering.
Aug 26 11:32:07 jupyterhub jupyterhub[469]: [I 2022-08-26 11:32:07.994 JupyterHub provider:607] Creating oauth client jupyterhub-user-rvaladao
Aug 26 11:32:08 jupyterhub jupyterhub[469]: [E 2022-08-26 11:32:08.095 JupyterHub user:815] Unhandled error starting rvaladaoâs server: Error while fetching server API version: (âConnection aborted.â, FileNotFoundError(2, âNo such file or directoryâ))
Aug 26 11:32:08 jupyterhub jupyterhub[469]: [E 2022-08-26 11:32:08.179 JupyterHub user:825] Failed to cleanup rvaladaoâs server that failed to start
Aug 26 11:32:08 jupyterhub jupyterhub[469]: Traceback (most recent call last):
Aug 26 11:32:08 jupyterhub jupyterhub[469]: File â/usr/local/lib/python3.9/dist-packages/jupyterhub/user.pyâ, line 823, in spawn
Aug 26 11:32:08 jupyterhub jupyterhub[469]: await self.stop(spawner.name)
Aug 26 11:32:08 jupyterhub jupyterhub[469]: File â/usr/local/lib/python3.9/dist-packages/jupyterhub/user.pyâ, line 917, in stop
Aug 26 11:32:08 jupyterhub jupyterhub[469]: status = await spawner.poll()
Aug 26 11:32:08 jupyterhub jupyterhub[469]: File â/usr/local/lib/python3.9/dist-packages/dockerspawner/dockerspawner.pyâ, line 961, in poll
Aug 26 11:32:08 jupyterhub jupyterhub[469]: container = await self.get_object()
Aug 26 11:32:08 jupyterhub jupyterhub[469]: File â/usr/local/lib/python3.9/dist-packages/dockerspawner/dockerspawner.pyâ, line 984, in get_object
Aug 26 11:32:08 jupyterhub jupyterhub[469]: obj = await self.docker(âinspect_%sâ % self.object_type, self.object_name)
Aug 26 11:32:08 jupyterhub jupyterhub[469]: File â/usr/lib/python3.9/concurrent/futures/thread.pyâ, line 52, in run
Aug 26 11:32:08 jupyterhub jupyterhub[469]: result = self.fn(*self.args, **self.kwargs)
Aug 26 11:32:08 jupyterhub jupyterhub[469]: File â/usr/local/lib/python3.9/dist-packages/dockerspawner/dockerspawner.pyâ, line 947, in _docker
Aug 26 11:32:08 jupyterhub jupyterhub[469]: m = getattr(self.client, method)
Aug 26 11:32:08 jupyterhub jupyterhub[469]: File â/usr/local/lib/python3.9/dist-packages/dockerspawner/dockerspawner.pyâ, line 122, in client
Aug 26 11:32:08 jupyterhub jupyterhub[469]: client = docker.APIClient(**kwargs)
Aug 26 11:32:08 jupyterhub jupyterhub[469]: File â/usr/local/lib/python3.9/dist-packages/docker/api/client.pyâ, line 197, in init
Aug 26 11:32:08 jupyterhub jupyterhub[469]: self._version = self._retrieve_server_version()
Aug 26 11:32:08 jupyterhub jupyterhub[469]: File â/usr/local/lib/python3.9/dist-packages/docker/api/client.pyâ, line 221, in _retrieve_server_version
Aug 26 11:32:08 jupyterhub jupyterhub[469]: raise DockerException(
Aug 26 11:32:08 jupyterhub jupyterhub[469]: docker.errors.DockerException: Error while fetching server API version: (âConnection aborted.â, FileNotFoundError(2, âNo such file or directoryâ))
Youâre right, now Iâm thinking itâs not being passed to JupyterHub. JupyterHub is running as a service [1].
I edited the code on [2], [3] to debug (I added the file-related lines), but it seems it never enters this part of the code, so I think DOCKER_HOST is never recognized by JupyterHub. Do you have any idea how to change that?
Thank you so much!
[1]
root@jupyterhub:/# systemctl status jupyterhub | grep active
Active: active (running) since Thu 2022-09-01 16:22:55 -03; 17h ago
Thank you, @manics! That solved my problem. I put DOCKER_HOST env variable in my systemd service file. But after that, I also had to create the docker network, as it wasnât created. Then, things started working correctly.