Repository navigation
Replies: 1 comment 1 reply
|
you dont need to start as root at runtime, do it once at build time in your own image. same pattern their docs use for extensions (customizing the image > installing additional php extensions): FROM serversideup/php:8.4-fpm-nginx-alpine
USER root
RUN apk add --no-cache mysql-client
USER www-dataon the debian variants its |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
👉 Describe the problem
PHP apps (Drupal, Laravel, WordPress) need the MySQL/MariaDB CLI (
mysql,mysqldump) in the container — not onlypdo_mysql/mysqli. Drush (sql:cli,sql:dump), Artisan, and WP-CLI all shell out to those binaries.The stock image does not include them. On Kubernetes we currently start as root and install at runtime:
That adds startup latency, depends on package repos at every pod start, and breaks the unprivileged default.
👥 Problem evidence & reach
Anyone running Drush, Laravel dump/restore, or WP-CLI against MySQL hits this. Existing workarounds are custom Dockerfiles (
default-mysql-clienton Debian,mysql-clienton Alpine) or CIapk add. Helm/K8s users who pull the Hub image directly cannot easily do that.🏆 How to solve this problem
Any of these would work (prefer 1 or 2 if default size is a concern):
INSTALL_MYSQL_CLIENT=true): entrypoint installs the distro client once at start, then continues aswww-data. Avoids a custom Dockerfile; still needs network/repos unless cached.8.4-fpm-nginx-mysql/8.4-cli-mysql(or a-toolsvariant). Same unprivileged image, no runtimeapk/apt.Package names
default-mysql-client(mysql-clienthas no candidate on current Debian)mysql-client(pullsmariadb-client)Estimated image size
Rough, from current distro packages (uncompressed in the image; compressed Hub layers are smaller):
mariadb-client: ~25–30 MB installed (~7 MB package download)default-mysql-client→mariadb-client: ~15–40 MB installed (metapackage itself is tiny; the client is the cost)A dedicated Alpine “mysql-client only” image is ~18 MB compressed; added to
serversideup/phpexpect on the order of ~10–20 MB extra compressed per tag, more on Debian if the full client (not-core) is used.🥰 Describe the "impact" on users?
Drush/Artisan/WP-CLI DB commands work without a custom Dockerfile or root
postStartinstall. Users who do not need the CLI keep a small default image (ENV or extra tag). Unprivileged user stays the default for bundled tags.💯 How do we validate the problem is solved?
On Debian and Alpine, as
www-data, without a custom image (bundled tag or ENV enabled):mysql --versionandmysqldump --versionsucceed.mysql -h … -e 'SELECT 1'and amysqldumpagainst a test DB work.drush sql:dumpor equivalent Artisan/WP-CLI command.All reactions