From 99e23d52631aada48bc645fe169246e7b06d68c2 Mon Sep 17 00:00:00 2001 From: MichaelKo Date: Tue, 29 Oct 2019 10:38:24 +0100 Subject: [PATCH] Don't show root warning for docker containers Signed-off-by: Viacheslav Sychov --- src/Composer/Console/Application.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index 171f4fc5b..e45ea8027 100644 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -212,7 +212,7 @@ class Application extends BaseApplication $io->writeError(sprintf('Warning: This development build of composer is over 60 days old. It is recommended to update it by running "%s self-update" to get the latest version.', $_SERVER['PHP_SELF'])); } - if (!Platform::isWindows() && function_exists('exec') && !getenv('COMPOSER_ALLOW_SUPERUSER')) { + if (!Platform::isWindows() && function_exists('exec') && !getenv('COMPOSER_ALLOW_SUPERUSER') && !file_exists('/.dockerenv')) { if (function_exists('posix_getuid') && posix_getuid() === 0) { if ($commandName !== 'self-update' && $commandName !== 'selfupdate') { $io->writeError('Do not run Composer as root/super user! See https://getcomposer.org/root for details');