Always include arguments when running docker-compose run

1

I have a question about passing arguments in docker-compose run:

I'm using a Dockerfile that has the following entrypoint:

ENTRYPOINT [ "/bin/wp" ]
CMD [ "--allow-root", "--help" ]

I need to --allow-root be ALWAYS included.

If I execute docker-compose run [service] the argument goes by default, but if I execute docker-compose run [service] option (option option...) I need to include the argument manually.

How can he ALWAYS include the argument? Do I need to edit Dockerfile (I'm not the author) or can I do it via docker-compose? I tried the command following #, but I did not succeed.

    
asked by anonymous 01.03.2018 / 18:17

1 answer

0

When any argument is passed to the docker-compose run [service] command, the arguments subscribe to the settings described in docker-compose.yml as described in the documentation link . You can not edit Dockerfile, but you can create a new Dockerfile that is derived and overwrites the entrypoint. Ex:

FROM vendor / image: tag

ENTRYPOINT ["/ bin / wp", "--allow-root"]

In this way the --allow-root parameter will always be present in the entrypoint and the parameters passed after run will be interpreted together with entrypoint.

It's important to analyze whether this parameter in entrypoint will not impact the use of the image.

    
03.03.2018 / 00:11