# Mounted Docker volume has different permissions when using Travis

**URL:** <https://travis-ci.community/t/mounted-docker-volume-has-different-permissions-when-using-travis/11118>\
**Category:** v2\
**Tags:** github-integration, travis-build\
**Created:** [February 2, 2021, 7:29am UTC](https://travis-ci.community/t/mounted-docker-volume-has-different-permissions-when-using-travis/11118 "2021-02-02T07:29:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SolarUltima](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/solarultima/32/4019_2.png) [@SolarUltima](https://travis-ci.community/u/SolarUltima)\
**Post date:** [February 2, 2021, 7:29am UTC](https://travis-ci.community/t/mounted-docker-volume-has-different-permissions-when-using-travis/11118/1 "2021-02-02T07:29:32Z")

</div>

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. The ownership is still different.

```auto
drwxrwxr-x 2 2000 2000 4096 Dec 10 19:58 .
drwsrwsr-x 1 solarultima users 4096 Nov 8 16:37 ..
-rw-rw-r-- 1 2000 2000 101 Dec 10 19:58 Dockerfile
-rw-rw-r-- 1 2000 2000 35271 Dec 10 19:58 post.ipynb

```

Both my local machine and Travis are running Ubuntu 20.04, so really not sure where problem is stem from.

---

<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:** [February 2, 2021, 7:33am UTC](https://travis-ci.community/t/mounted-docker-volume-has-different-permissions-when-using-travis/11118/2 "2021-02-02T07:33:04Z")

</div>

Try running Docker again with this command, so the `uid` outside the container is propagated inside:

```auto
docker run -u $(id -u)

```

This should involve the creation of the new files inside the docker to be owned by `"solarultima"` .

If you are able to guess that mounting points will exist in a particular container, you could also pre-create them so the ownership of the files inside are also correct, to avoid this issue.

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

```

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

---

<div class="post-metadata">

**Author:** ![SolarUltima](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/solarultima/32/4019_2.png) [@SolarUltima](https://travis-ci.community/u/SolarUltima)\
**Post date:** [February 2, 2021, 10:05am UTC](https://travis-ci.community/t/mounted-docker-volume-has-different-permissions-when-using-travis/11118/3 "2021-02-02T10:05:01Z")

</div>

this worked beautifully! thank you @Montana

---

<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:** [February 2, 2021, 10:06am UTC](https://travis-ci.community/t/mounted-docker-volume-has-different-permissions-when-using-travis/11118/4 "2021-02-02T10:06:08Z")

</div>

That’s great to hear @SolarUltima.

If you need anymore help on anything else, don’t hesitate to ask.
