Skip to content

Spawned container network settings not populated #460

@vincenzon

Description

@vincenzon

My spawned containers are not getting their network settings populated. When I inspect the spawned container's network settings I see:

        "Networks": {
            "jupyterhub_network": {
                "IPAMConfig": null,
                "Links": null,
                "Aliases": [
                    "f53d628d5d68"
                ],
                "NetworkID": "8216769bc20a2aec29fd8de162031ccd584f9f3ee391855942b2a1e2a7113159",
                "EndpointID": "",
                "Gateway": "",
                "IPAddress": "",
                "IPPrefixLen": 0,
                "IPv6Gateway": "",
                "GlobalIPv6Address": "",
                "GlobalIPv6PrefixLen": 0,
                "MacAddress": "",
                "DriverOpts": null
            }

This leads to a failure to start the container:

Error starting server matt: The 'ip' trait of a Server instance expected a unicode string, not the NoneType None.

Expected behaviour

I think the IPAddress field should show the ip address on the jupyterhub_network, as for example it does for the hub container:

        "Networks": {
            "jupyterhub_network": {
                "IPAMConfig": null,
                "Links": null,
                "Aliases": [
                    "a6292862e2c7",
                    "jupyterhub"
                ],
                "NetworkID": "8216769bc20a2aec29fd8de162031ccd584f9f3ee391855942b2a1e2a7113159",
                "EndpointID": "7559ad58e2b871ad3ba7b0c53a6ccfd9a8bf8ef54bc6101bd46044532aa417d2",
                "Gateway": "172.26.0.1",
                "IPAddress": "172.26.0.2",
                "IPPrefixLen": 16,
                "IPv6Gateway": "",
                "GlobalIPv6Address": "",
                "GlobalIPv6PrefixLen": 0,
                "MacAddress": "02:42:ac:1a:00:02",
                "DriverOpts": null
            }

Actual behaviour

If I start the spawn container from the command line, I do see network settings populated:

docker run -it --network jupyterhub_network jupyterlab_img bash

Yields:

        "Networks": {
            "jupyterhub_network": {
                "IPAMConfig": null,
                "Links": null,
                "Aliases": [
                    "b00e6fe8fa9c"
                ],
                "NetworkID": "8216769bc20a2aec29fd8de162031ccd584f9f3ee391855942b2a1e2a7113159",
                "EndpointID": "f332478214ae493761fa2b70f051cc08a6204f1db18ebd927754132266a1dd74",
                "Gateway": "172.26.0.1",
                "IPAddress": "172.26.0.3",
                "IPPrefixLen": 16,
                "IPv6Gateway": "",
                "GlobalIPv6Address": "",
                "GlobalIPv6PrefixLen": 0,
                "MacAddress": "02:42:ac:1a:00:03",
                "DriverOpts": null
            }
        }

My setup is following the jupyterhub-deploy-docker repo. I think the relevant settings are:

docker-compose.yml, each service is tagged with the network and it is named at the end:

    ...
    networks:
      - jupterhub_network

networks:
  jupterhub_network:
    external:
      name: jupyterhub_network

The network exists and the sha matches the values in the inspect's above:

$ docker network ls | grep jup
8216769bc20a   jupyterhub_network     bridge    local

The jupyterhub config points to:

## Docker spawner
c.JupyterHub.spawner_class = 'dockerspawner.DockerSpawner'
c.DockerSpawner.image = 'jupyterlab_img'
c.DockerSpawner.network_name = 'jupyterhub_network'
# See https://github.com/jupyterhub/dockerspawner/blob/master/examples/oauth/jupyterhub_config.py
c.JupyterHub.hub_ip = 'jupyterhub'
c.JupyterHub.hub_port = 8080

Thanks for any help that you can provide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions