# JupyterHub with Podman and DockerSpawner: Singleserver Containers can't communicate with outside

**URL:** <https://discourse.jupyter.org/t/jupyterhub-with-podman-and-dockerspawner-singleserver-containers-cant-communicate-with-outside/23741>\
**Category:** JupyterHub\
**Tags:** community, jupyterhub, help-wanted, notebook\
**Created:** [February 1, 2024, 8:46pm UTC](https://discourse.jupyter.org/t/jupyterhub-with-podman-and-dockerspawner-singleserver-containers-cant-communicate-with-outside/23741 "2024-02-01T20:46:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yamr](https://avatars.discourse-cdn.com/v4/letter/y/f475e1/32.png) [@Yamr](https://discourse.jupyter.org/u/Yamr)\
**Post date:** [February 1, 2024, 8:46pm UTC](https://discourse.jupyter.org/t/jupyterhub-with-podman-and-dockerspawner-singleserver-containers-cant-communicate-with-outside/23741/1 "2024-02-01T20:46:04Z")

</div>

Hi guys,

I spwan singleuser containers using Jupyterhub with podman. The Singleservers are accessible, but can’t connect to the outside:

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/jupyter/original/2X/8/857ab51870a31436d58a84eaf81cbc315cca404d.png)

Here the configuration file:

```auto
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))

c.JupyterHub.hub_ip = s.getsockname()[0]
s.close()

c.JupyterHub.authenticator_class = "dummy"
c.Authenticator.admin_users = {'demo'}

c.JupyterHub.log_level = 'DEBUG'
c.ConfigurableHTTPProxy.debug = True

c.Authenticator.admin_users = {'Admin'}

c.JupyterHub.spawner_class = 'docker'
c.DockerSpawner.remove = True
c.DockerSpawner.default_url = '/lab'
c.DockerSpawner.start_timeout = 300
c.DockerSpawner.http_timeout = 120
c.DockerSpawner.use_internal_ip = True

c.DockerSpawner.network_name = 'jupyter_default'

c.DockerSpawner.debug = True

notebook_dir = os.environ.get('DOCKER_NOTEBOOK_DIR') or '/home/jovyan/work'
c.DockerSpawner.notebook_dir = notebook_dir

c.DockerSpawner.image = "jupyter/base-notebook:latest" #jupyter/datascience-notebook:latest docker pull jupyter/base-notebook

c.Spawner.cpu_limit = 1
c.Spawner.mem_limit = '8G'

```

This only occurs with containers ran with Jupyterhub. When I run the same image directly with podman:

```auto
services:
  jupyter:
    image: jupyter/base-notebook:latest
    container_name: JupyterLab_5
    restart: "always"
    ports:

      - "8886:8888"
    volumes:
      - /data/data_analysis:/home/jovyan/work/data_analysis

```

I run this compose file using podman compose. Here si how podman run the image:

```auto
podman create --name=JupyterLab_5 --label io.podman.compose.config-hash=123 
--label io.podman.compose.project=jupyter --label io.podman.compose.version=0.0.1 
--label com.docker.compose.project=jupyter --label com.docker.compose.project.working_dir=/home/rootx/jupyter 
--label com.docker.compose.project.config_files=docker-compose.yml --label com.docker.compose.container-number=1 
--label com.docker.compose.service=jupyter -v /data/data_analysis:/home/jovyan/work/data_analysis --net jupyter_default 
--network-alias jupyter -p 8886:8888 --restart always docker.io/jupyter/datascience-notebook

```

I could not find out why the containers run by Jupyterhub can’t access the outside. Hope someone can help. Thanks!

---

<div class="post-metadata">

**Author:** ![mahendrapaipuri](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/mahendrapaipuri/32/6800_2.png) [@mahendrapaipuri](https://discourse.jupyter.org/u/mahendrapaipuri)\
**Post date:** [February 2, 2024, 8:13am UTC](https://discourse.jupyter.org/t/jupyterhub-with-podman-and-dockerspawner-singleserver-containers-cant-communicate-with-outside/23741/2 "2024-02-02T08:13:02Z")

</div>

After you spawn a single user server from JupyterHub, could you try to spawn a shell into singleuser container and check for connectivity using `curl`. Something like

```auto
$ podman exec -it <singleuser_container> bash
$ curl -vvvv -I https://8.8.8.8

```

---

<div class="post-metadata">

**Author:** ![Yamr](https://avatars.discourse-cdn.com/v4/letter/y/f475e1/32.png) [@Yamr](https://discourse.jupyter.org/u/Yamr)\
**Post date:** [February 3, 2024, 1:16pm UTC](https://discourse.jupyter.org/t/jupyterhub-with-podman-and-dockerspawner-singleserver-containers-cant-communicate-with-outside/23741/3 "2024-02-03T13:16:16Z")

</div>

Hello Mahendra,

Thanks a lot! I spotted the difference with your command. For the singleserver spawned with Jupyterhub proxy variable (https\_proxy, no\_proxy) from the host are not being passed to the server (when running the singleserver directly with podman, they get passed)! And because we work behind a corporate proxy the Server can’t reach outside. When I logged in inside the container and added the proxy variables manually, it worked! Thanks a lot
