TravisCI Docker Permissions
<p>I use Docker to run my PHP app. Now I want Travis CI to test my app. But all my builds fail, because containers can not open files in /temp directory of my app.</p>

<p>I have data container:</p>

<pre><code>FROM ubuntu

COPY ./ /project
VOLUME /project

CMD ["true"]
</code></pre>

<p>I use my own PHP fpm container based on php:7.0-fpm - only with some extensions installed. Same for nginx.</p>

<p>My docker compose looks like this</p>

<pre><code>version: '2'
services:
  data:
    build: ./
    volumes:
      - .:/project
    command: "true"
  nginx:
    image: myNginx
    ports:
      - "80:80"
      - "443:443"
    volumes_from:
      - data
    links:
      - php
  php:
    image: myPhp
    ports:
      - "9000:9000"
    volumes_from:
      - data
</code></pre>

<p>You can see that I use shared volume with host. Everything works on my local machine (windows) but not on travis.</p>

<p>And finaly my travis.yml</p>

<pre><code>sudo: required

language: php

services:
  - docker

before_script:
  - docker-compose up --build -d
  # Run firefox
  - docker run -d -p 4444:4444 -p 5900:5900 --name firefox --link my_nginx:nginx --net myapp_default selenium/standalone-firefox-debug:2.53.0

script:
  # Run Codeception
  - docker run --rm --volumes-from my_data --link firefox --net myapp_default --name codeception codeception/codeception run accept
</code></pre>

<p>All codeception tests fails because app can not write to /log and can not open files in /temp. It is interesting because it writes some files but later it can not open it.</p>

<p>I ls -la with result:</p>

<pre><code># ./temp
drwxrwxr-x  3 travis travis 4096 Nov  4 15:55 .
drwxrwxr-x 14 travis travis 4096 Nov  4 15:56 ..
drwxr-xr-x  4 root   root   4096 Nov  4 15:55 cache
-rw-rw-r--  1 travis travis   14 Nov  4 15:49 .gitignore

# ./temp/cache
drwxr-xr-x 4 root   root   4096 Nov  4 15:55 .
drwxrwxr-x 3 travis travis 4096 Nov  4 15:55 ..
drwxr-xr-x 2 root   root   4096 Nov  4 15:55 Nette.Configurator
drwxr-xr-x 2 root   root   4096 Nov  4 15:55 _Nette.RobotLoader

# ./temp/cache/Nette.Configurator
drwxr-xr-x 2 root root   4096 Nov  4 15:55 .
drwxr-xr-x 4 root root   4096 Nov  4 15:55 ..
-rw-r--r-- 1 root root 116093 Nov  4 15:55 Container_70d15d6361.php
-rw-r--r-- 1 root root      0 Nov  4 15:55 Container_70d15d6361.php.lock
-rw-r--r-- 1 root root  52913 Nov  4 15:55 Container_70d15d6361.php.meta
</code></pre>

<p>I ma pretty sure that I have bad permissions set in travis or in container, but I don`t know how to fix it.</p>