Cannot write to out in build dir from Docker

Im using TravisCI to build packages for the Linux distro Im building, for the past few hours Ive been unable to get run.sh (the script which runs the build process) to run without erroring. Here’s the repository that has the docker stuff (https://github.com/ronixos/docker-build).

The error message:

$ ./run.sh

==> Building repo: core

mkdir: cannot create directory ‘/tmp/out/core’: Permission denied

The command "./run.sh" exited with 1.

/tmp/out is setup to write to the out directory in the repository. People say to check file permissions but I don’t need to since the container works on my computer. To show its not a permissions issue, I ran ls -ahl in the build.

$ ls -ahl

total 92K

drwxrwxr-x 6 travis travis 4.0K Aug 10 01:13 .

drwxrwxr-x 3 travis travis 4.0K Aug 10 01:13 ..

drwxrwxr-x 5 travis travis 4.0K Aug 10 01:13 aur

-rw-rw-r-- 1 travis travis 3.4K Aug 10 01:13 deploy_rsa.enc

-rw-rw-r-- 1 travis travis  827 Aug 10 01:13 Dockerfile

drwxrwxr-x 9 travis travis 4.0K Aug 10 01:13 .git

-rw-rw-r-- 1 travis travis   50 Aug 10 01:13 .gitignore

-rw-rw-r-- 1 travis travis  379 Aug 10 01:13 .gitmodules

-rwxrwxr-x 1 travis travis   68 Aug 10 01:13 init.sh

-rw-rw-r-- 1 travis travis  35K Aug 10 01:13 LICENSE

drwxrwxr-x 2 travis travis 4.0K Aug 10 01:13 out

-rw-rw-r-- 1 travis travis  321 Aug 10 01:13 README.md

-rwxrwxr-x 1 travis travis  196 Aug 10 01:13 run.sh

drwxrwxr-x 3 travis travis 4.0K Aug 10 01:13 src

-rw-rw-r-- 1 travis travis  556 Aug 10 01:13 .travis.yml

The command "ls -ahl" exited with 0.

Check the current user and permissions from inside Docker, too.

$ ./run.sh

.:

total 16K

drwxrwxr-x 3 2000 2000 4.0K Aug 10 15:28 .

drwxr-xr-x 1 root root 4.0K Aug 10 15:34 ..

-rwxrwxr-x 1 2000 2000 1.1K Aug 10 15:28 build.sh

drwxrwxr-x 3 2000 2000 4.0K Aug 10 15:28 repos

/tmp/out:

total 12K

drwxrwxr-x 2 2000 2000 4.0K Aug 10 15:28 .

drwxrwxrwt 1 root root 4.0K Aug 10 15:34 ..

-rw-rw-r-- 1 2000 2000    2 Aug 10 15:28 .gitignore

The container run the build process as a user calldd builder. It looks like builder’s uid should be set to 2000 and it’ll work i think.

More likely, to the UID of travis.

Alternatively, give write permissions to your internal UID for those directories.