Docker compose error: "Do not run Composer as root/super user! See https://getcomposer.org/root for details."

"Do not run Composer as root/super user! See https://getcomposer.org/root for details."

By default composer commands will not execute if its running as root user.

In docker automation setups all the commands running as root user and as a result composer failed execution.

We can solve this problem by adding one optoin to the docker command.

For example to run composer install,

#docker exec CONTAINERID COMPOSER_ALLOW_SUPERUSER=1 composer install

Here CONTAINERID should be replaced by the id of the docker container.

In this way we can run any composer commands without any issues.

That's all…

Leave a Reply