From c2ae55cb15d12e8714294f35b846f41124dfc614 Mon Sep 17 00:00:00 2001 From: Robert Anderson Date: Mon, 24 Feb 2020 15:20:11 +1100 Subject: [PATCH] @wordpress/env: Use user with UID=33 to run WP CLI commands (#20403) The www-data user in wordpress:cli has a different UID (82) to the www-data user in wordpress (33). Ensure we use the wordpress www-data user for CLI commands. See https://github.com/docker-library/wordpress/issues/256 for more discussion. --- packages/env/lib/build-docker-compose-config.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/env/lib/build-docker-compose-config.js b/packages/env/lib/build-docker-compose-config.js index 836aa1bf002e4..36d97bace63de 100644 --- a/packages/env/lib/build-docker-compose-config.js +++ b/packages/env/lib/build-docker-compose-config.js @@ -55,6 +55,12 @@ module.exports = function buildDockerComposeConfig( config ) { const developmentPorts = `\${WP_ENV_PORT:-${ config.port }}:80`; const testsPorts = `\${WP_ENV_TESTS_PORT:-${ config.testsPort }}:80`; + // The www-data user in wordpress:cli has a different UID (82) to the + // www-data user in wordpress (33). Ensure we use the wordpress www-data + // user for CLI commands. + // https://github.com/docker-library/wordpress/issues/256 + const cliUser = '33:33'; + return { version: '3.7', services: { @@ -86,11 +92,13 @@ module.exports = function buildDockerComposeConfig( config ) { depends_on: [ 'wordpress' ], image: 'wordpress:cli', volumes: developmentMounts, + user: cliUser, }, 'tests-cli': { depends_on: [ 'wordpress' ], image: 'wordpress:cli', volumes: testsMounts, + user: cliUser, }, composer: { image: 'composer',