M
M
Mikhail Melnik2017-10-31 13:36:42
Composer
Mikhail Melnik, 2017-10-31 13:36:42

How to run composer install with docker-compose up --build not as root?

Hi all. Faced a similar issue . Dug up this option:

composer:
        restart: 'no'
        image: composer:latest
        command: install -d /var/www/symfony
        depends_on:
          - php
          - db
        volumes:
            - ${SYMFONY_APP_PATH}:/var/www/symfony

at docker-compose up --build the composer fulfills. The vendor folder, app/config/parameters.yml, bin/symfony_requirements is created, but they are created from root. How can I run a command as my user?
Now I'm trying the following option: prescribe the creation of a user in the Dockerfile and then use the user directive: in docker-compose.yml specify from whom to run install

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
planc, 2017-10-31
@planc

you don’t need to create a separate image and config for the composer at all,
just take any image from php that you have, docker run --rm -it -v directory:/code php bash
# useradd --uid user_id_on_host name
# su new_user_name
# cd /code
and install

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question