# Mounted Docker volume has different ownership when using Travis

**URL:** <https://travis-ci.community/t/mounted-docker-volume-has-different-ownership-when-using-travis/13221>\
**Category:** Deployment\
**Created:** [August 18, 2022, 1:05am UTC](https://travis-ci.community/t/mounted-docker-volume-has-different-ownership-when-using-travis/13221 "2022-08-18T01:05:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Northskool](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/northskool/32/8176_2.png) [@Northskool](https://travis-ci.community/u/Northskool)\
**Post date:** [August 18, 2022, 1:05am UTC](https://travis-ci.community/t/mounted-docker-volume-has-different-ownership-when-using-travis/13221/1 "2022-08-18T01:05:38Z")

</div>

The repository is for static site built from Jupyter notebooks. The notebooks are converted using `build/build.py` which, for each post, builds a Docker image, starts a corresponding container with the post notebook directory mounted, and uses `nbconvert` to convert the notebook to Markdown. One step of `nbconvert`’s conversion involves creating a supporting file directory. This fails on Travis due to a permission issue.

In attempting to debug this problem, I found that the ownership and permissions of the repo are the same on my local machine and Travis (with my username switched for `travis`) before running Docker. Despite this, inside the mounted volume of the Docker container, the ownerships are different.

Very confused.

---

<div class="post-metadata">

**Author:** ![Montana](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/montana/32/9566_2.png) [@Montana](https://travis-ci.community/u/Montana)\
**Post date:** [August 18, 2022, 1:09am UTC](https://travis-ci.community/t/mounted-docker-volume-has-different-ownership-when-using-travis/13221/2 "2022-08-18T01:09:36Z")

</div>

Hello @Northskool,

This should involve the creation of the new files inside the Docker container to be owned by `DOCKER_USER_ID`.

If you are able to guess that mounting points will exist, you could also pre-create them so the ownership of the files inside is also correct:

```bash
docker run -v /path/on/host:/path/in/container ...

```

If you set the permissions of your local path (`/path/on/host`) as 777, that will also be propagated to the mounting point: no permission error will be thrown regardless of the user that container uses to create those files.

After that, you’ll be free to restore permissions, if needed.

---

<div class="post-metadata">

**Author:** ![Northskool](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/northskool/32/8176_2.png) [@Northskool](https://travis-ci.community/u/Northskool)\
**Post date:** [August 18, 2022, 6:20pm UTC](https://travis-ci.community/t/mounted-docker-volume-has-different-ownership-when-using-travis/13221/3 "2022-08-18T18:20:59Z")

</div>

This was it @Montana, thank you.

---

<div class="post-metadata">

**Author:** ![Montana](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/montana/32/9566_2.png) [@Montana](https://travis-ci.community/u/Montana)\
**Post date:** [August 18, 2022, 7:30pm UTC](https://travis-ci.community/t/mounted-docker-volume-has-different-ownership-when-using-travis/13221/4 "2022-08-18T19:30:10Z")

</div>

Glad I could help @Northskool.
