# Adding docker volume mounts with SystemUserSpawner?

**URL:** <https://discourse.jupyter.org/t/adding-docker-volume-mounts-with-systemuserspawner/5379>\
**Category:** JupyterHub\
**Tags:** jupyterhub, help-wanted\
**Created:** [July 27, 2020, 5:23am UTC](https://discourse.jupyter.org/t/adding-docker-volume-mounts-with-systemuserspawner/5379 "2020-07-27T05:23:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shardo](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/shardo/32/2066_2.png) [@shardo](https://discourse.jupyter.org/u/shardo)\
**Post date:** [July 27, 2020, 5:23am UTC](https://discourse.jupyter.org/t/adding-docker-volume-mounts-with-systemuserspawner/5379/1 "2020-07-27T05:23:09Z")

</div>

I am using the SystemUserSpawner to spawn docker containers which persist storage to the user’s home directory on disk. I want to mount some other directories to the container and persist them to the home directory as well.

I tried this first:

```auto
c.DockerSpawner.volumes = { '/home/{username}/example': '/etc/example' }

```

JupyterHub starts the container without complaining, but a `docker inspect` shows that no such volume mount has been created.

I tried subclassing the spawner in the config as well, which similarly does nothing:

```auto
from dockerspawner import SystemUserSpawner
class MyDockerSpawner(SystemUserSpawner):
    def start(self):
        self.volumes['/home/{username}/example'] = {
            'bind': '/etc/example',
            'mode': 'rw'
        }
        return super().start()
c.JupyterHub.spawner_class = MyDockerSpawner

```

What am I missing here? How do I add mount points to the containers that get spawned?

---

<div class="post-metadata">

**Author:** ![shardo](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/shardo/32/2066_2.png) [@shardo](https://discourse.jupyter.org/u/shardo)\
**Post date:** [July 27, 2020, 6:26am UTC](https://discourse.jupyter.org/t/adding-docker-volume-mounts-with-systemuserspawner/5379/2 "2020-07-27T06:26:39Z")

</div>

It looks like this works after deleting the container image and letting jupyterhub create a new one.
