# Running a repo2docker built container on Linux docker

**URL:** <https://discourse.jupyter.org/t/running-a-repo2docker-built-container-on-linux-docker/6151>\
**Category:** Binder\
**Created:** [September 28, 2020, 11:32am UTC](https://discourse.jupyter.org/t/running-a-repo2docker-built-container-on-linux-docker/6151 "2020-09-28T11:32:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![psychemedia](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/psychemedia/32/24_2.png) [@psychemedia](https://discourse.jupyter.org/u/psychemedia)\
**Post date:** [September 28, 2020, 11:32am UTC](https://discourse.jupyter.org/t/running-a-repo2docker-built-container-on-linux-docker/6151/1 "2020-09-28T11:32:53Z")

</div>

Hi

Running a repo2docker built container pushed to Dockerhub on Linux running docker causes a “permission denied” error when trying to create / save a notebook in a shared volume directory, apparently because directories mounted inside the container (eg `-v $PWD:/home/jovyan/notebooks`) is owned by root.

Running:

`docker exec -u 0 mycontainer chown -R jovyan /home/jovyan`

on host fixes the permissions and allows notebooks to be saved.

Is there a way to start the container that doesn’t require this fix?

–tony

---

<div class="post-metadata">

**Author:** ![manics](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/manics/32/85_2.png) [@manics](https://discourse.jupyter.org/u/manics)\
**Post date:** [September 28, 2020, 6:18pm UTC](https://discourse.jupyter.org/t/running-a-repo2docker-built-container-on-linux-docker/6151/2 "2020-09-28T18:18:00Z")

</div>

The Jupyter docker-stack images include support for changing the ownership of `$HOME` when run as root, but repo2docker uses it’s own base image that doesn’t include that script. You could perhaps use a `start` script?

> **[Configuration Files — repo2docker 0.11.0+169.gae6c2dc documentation](https://repo2docker.readthedocs.io/en/latest/config_files.html#start-run-code-before-the-user-sessions-starts)**

  
Though you’d need to start your repo2docker container as `root`.  
Otherwise you’ll have to chown `$PWD` to whatever UID you’re using inside the repo2docker image before you run your container.

---

<div class="post-metadata">

**Author:** ![psychemedia](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/psychemedia/32/24_2.png) [@psychemedia](https://discourse.jupyter.org/u/psychemedia)\
**Post date:** [September 28, 2020, 9:49pm UTC](https://discourse.jupyter.org/t/running-a-repo2docker-built-container-on-linux-docker/6151/3 "2020-09-28T21:49:50Z")

</div>

I’ve found one workaround is to start the container with _–user 1234_, which lets me copy stuff from host into the container, and the docker exec command to reset the mounted dir own which lets me save notebooks to the shared folder inside the container.  
Not ideal, but it seems to work.

What I’ve been trying to find is a workflow that lets me build an image that I can run locally or that can equally be used directly in a jupyterhub / dockerspawner setting. My current workflow has the image defined using a .binder config in a Github repo, and a repo2docker/dockerhub action so I can:

- run the envt in MyBinder
- build and push an image via the repo2docker/dockerhub action

And then either use the image locally (tested) or (hopefully) directly in a jupyterhub/dockerspawner envt.

–tony

---

<div class="post-metadata">

**Author:** ![manics](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/manics/32/85_2.png) [@manics](https://discourse.jupyter.org/u/manics)\
**Post date:** [September 29, 2020, 4:25pm UTC](https://discourse.jupyter.org/t/running-a-repo2docker-built-container-on-linux-docker/6151/4 "2020-09-29T16:25:21Z")

</div>

Is specifying a group-id either as part of `docker run` or `repo2docker` an option? That way you could have a UID that works with mybinder and a GID that works locally, or vice-versa.
