Home > Enterprise >  Docker volume to authorize composer and symfony to write in the project folder
Docker volume to authorize composer and symfony to write in the project folder

Time:10-05

How authorizing the docker php container to write in the project folder?

  php:
    build:
      context: .docker/php
    restart: on-failure
    volumes:
      - ./:/var/www/server:cached
      - ./:/var/www/symfony
      - ./logs/symfony:/var/www/symfony/app/logs
      - ./.docker/php/php.ini:/usr/local/etc/php/php.ini:ro
    depends_on:
      - mariadb
    user: "${ID_USER:-1001}:${ID_USER:-1001}"

After a docker-composer exec php composer install, I have this error message:

In Git.php line 471:
                                                                                                                                                                             
  Failed to execute git clone --mirror -- 'https://github.com/hide/hideResourceBundle.git' '/.composer/cache/vcs/https---github.com-hide-hideResourceBundle  
  .git/'                                                                                                                                                                     
                                                                                                                                                                             
  fatal: could not create leading directories of '/.composer/cache/vcs/https---github.com-hide-hideResourceBundle.git' 

                                          
                                                                                                                                                                         

CodePudding user response:

If you need to install then you should do it as root:

docker-compose exec -u "0:0" php composer install
  • Related