Debian and Ubuntu
Dockerfile
Alpine
Dockerfile
1RUN yes "$password" | adduser --gecos "$comment" "$username"
Variables
$username
— username;$password
— password (can be equal to username for convenience);$comment
— comment (GECOS field).
Documentation
- useradd(8) — Debian Bullseye
- useradd(8) — Ubutnu 20.04 LTS (Focal Fossa)
- useradd(8) — Ubutnu 22.04 LTS (Jammy Jellyfish)
- Setting up a new user — Alpine Linux