php - TravisCI Docker Permissions -
i use docker run php app. want travis ci test app. builds fail, because containers can not open files in /temp directory of app.
i have data container:
from ubuntu copy ./ /project volume /project cmd ["true"]
i use own php fpm container based on php:7.0-fpm - extensions installed. same nginx.
my docker compose looks this
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
you can see use shared volume host. works on local machine (windows) not on travis.
and finaly travis.yml
sudo: required language: php services: - docker before_script: - docker-compose --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
all codeception tests fails because app can not write /log , can not open files in /temp. interesting because writes files later can not open it.
i ls -la result:
# ./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
i ma pretty sure have bad permissions set in travis or in container, don`t know how fix it.
the files travis pulls owned travis
user , group, while processes running inside container expect active user owner. had issue docker-compose file running fine on mac, failed on travis.
for me, fixed adding install
step in .travis.yaml
(edit: you'll want in before_script
section instead):
install - docker-compose run --user='root' --entrypoint chown worker_test -r myuser:myuser .
this writeup on uid/gid bits helpful: understanding user file ownership in docker: how avoid changing permissions of linked volumes
Comments
Post a Comment