docs: fix user creation example in Ubuntu-based Docker images (#1243)

* Fix user creation in default docker images

The `adduser` command uses `-D` to mean "create with defaults". The `useradd` command uses `-D` to mean "show or edit the defaults".

man pages:

- [`useradd`](https://manpages.debian.org/jessie/passwd/useradd.8.en.html)
- [`adduser](https://manpages.debian.org/jessie/adduser/adduser.8.en.html)

(Those are for Debian, but they are very similar for every other distro that I checked)

* Use a different username that doesn't already exist
This commit is contained in:
MK
2024-12-13 19:41:56 -05:00
committed by GitHub
parent 2f3e4b650b
commit 047ce0c8b2

View File

@@ -149,11 +149,11 @@ Here is a sample `Dockerfile` doing this:
```dockerfile
FROM dunglas/frankenphp
ARG USER=www-data
ARG USER=appuser
RUN \
# Use "adduser -D ${USER}" for alpine based distros
useradd -D ${USER}; \
useradd ${USER}; \
# Add additional capability to bind to port 80 and 443
setcap CAP_NET_BIND_SERVICE=+eip /usr/local/bin/frankenphp; \
# Give write access to /data/caddy and /config/caddy
@@ -173,11 +173,11 @@ the webserver as a non-root user, and without the need for any capability:
```dockerfile
FROM dunglas/frankenphp
ARG USER=www-data
ARG USER=appuser
RUN \
# Use "adduser -D ${USER}" for alpine based distros
useradd -D ${USER}; \
useradd ${USER}; \
# Remove default capability
setcap -r /usr/local/bin/frankenphp; \
# Give write access to /data/caddy and /config/caddy