Part of my docker compose file
version: "3.1" services: codecontainer: container_name: codecontainer build: . user: www-data volumes: - codecontainerdata:/var/www/html php: container_name: php restart: always build: context: ./build/php args: ENVIRONMENT: ${ENVIRONMENT} volumes: - codecontainerdata:/var/www/html - ./logs/php/:/var/log depends_on: - codecontainer user: www-data volumes: pgdata: codecontainerdata:
- Both Dockerfiles creating same www-data user and group
- Dockerfile in Codecontainer copy files into /var/www/html
- all files in dir /var/www/html inside codecontainer are getting chown www-data:www-data
- docker-compose up
Problem:
- docker exec -ti -u www-data php ls -la /var/www/html => all files are owned root:root
- docker exec -ti php chown -R www-data:www-data /var/www
- … chown: /var/www/html/README.md: Operation not permitted …
Additional Information:
Working on my mac and on linux
the job from .config.yml
integration_tests: docker: - image: docker:17.09.0-ce working_directory: ~/repo/Api/ steps: - checkout - setup_remote_docker: version: 17.09.0-ce docker_layer_caching: true - run: name: install python3 command: apk update && apk add --no-cache python3 - run: name: Install Docker Compose command: | set -x VER="1.16.1" pip3 install docker-compose==$VER - run: name: Start container with docker compose command: | set -x docker-compose up --build -d environment: ENVIRONMENT: test APPLICATION_CACHE: false APPLICATION_DEBUG: false LOCALE: en - run: name: install dependencies command: | set -x docker exec -ti -u www-data php ./composer.phar install - run: name: test db schema command: | set -x docker exec -ti -u www-data php ./bin/console doctrine:schema:validate --skip-sync - run: name: run integration tests command: | set -x docker exec -ti -u www-data php ./composer.phar integ