10up / wp-local-docker-v2

ARCHIVED: A simple Docker based development environment for WordPress.
MIT License
484 stars 82 forks source link

10updocker create does not build phpfpm container on Ubuntu 22.04 (LTS) when logged in as root #348

Closed elindydotcom closed 1 year ago

elindydotcom commented 1 year ago

Troubleshooting

Describe the bug

When using the 10updocker create command on ubuntu 22.04 and logged in as root, the process errors out when building phpfpm.

The error is as follows:

#5 [2/7] RUN useradd root -u 0
#5 0.524 useradd: user 'root' already exists
#5 ERROR: process "/bin/bash -c useradd ${CALLING_USER} -u ${CALLING_UID}" did not complete successfully: exit code: 9
------
 > [2/7] RUN useradd root -u 0:
0.524 useradd: user 'root' already exists
------
php-fpm:11
--------------------
   9 |     USER root
  10 |     
  11 | >>> RUN useradd ${CALLING_USER} -u ${CALLING_UID}
  12 |     RUN mkdir -p /run/php-fpm
  13 |     RUN chown ${CALLING_USER} /run/php-fpm
--------------------
ERROR: failed to solve: process "/bin/bash -c useradd ${CALLING_USER} -u ${CALLING_UID}" did not complete successfully: exit code: 9
Service 'phpfpm' failed to build : Build failed

Steps to Reproduce

  1. Run 10updocker create
  2. Accept all defaults
  3. Error is thrown.

Screenshots, screen recording, code snippet

https://www.screencast.com/t/Zpd3b5z0CfSc

Environment information

-Device: Ubuntu 22.04 VM on DigitalOcean -OS: Ubuntu 22.04 with all updates applied -Docker Desktop Version: n/a - using docker engine on ubuntu 22.04 only -browser and version: n/a - didn't get that far.

Code of Conduct

dustinrue commented 1 year ago

Why are you running it as root?

elindydotcom commented 1 year ago

Why are you running it as root?

It's the default user for a new DigitalOcean Ubuntu 22.04 VM. We just spun it up and installed wp-local-docker for testing (first time we've' tried it). So just used the 'root' user for everything.

Should it be installed as a different user? Or should we install it as root and then create a new user for running the 10updocker commands?

('root' is also the default user for Linode and Vultr VMs while 'ubuntu' is the default user for some other cloud provider server VMs).

dustinrue commented 1 year ago

Sounds like you are using remote VMs to create remote based development environments. I would recommend creating a non-admin user to run your environments in as well as ensuring you have solid protections in place so your environment and the projects you are working on are not exposed. This project is meant to be run locally and you will need to perform additional changes to make it work remotely.