php
php copied to clipboard
Generic PHP docker container images
PHP Docker Container Images
Table of Contents
- Docker Images
-dev-dev-macos- Supported architectures
- Environment Variables
- PHP and PHP-FPM configuration
- Additional configuration
- Build arguments
- PHP Extensions
- Tools
- Xdebug
- Changelog
- Users and permissions
- Crond
- SSHD
- Adding SSH key
- Complete PHP-based stack
- Images based on
wodby/php - Orchestration Actions
Docker Images
❗For better reliability we release images with stability tags (wodby/php:8.1-X.X.X) which correspond
to git tags. We strongly recommend using images only with stability tags.
About images:
- All images based on Alpine Linux
- Base image: official php
- GitHub actions builds
- Docker Hub
Supported tags and respective Dockerfile links:
8.1,8,latest(8/Dockerfile)8.0(8/Dockerfile)7.4,7(7/Dockerfile)8.1-dev,8-dev,dev(8/Dockerfile)8.0-dev(8/Dockerfile)7.4-dev,7-dev(7/Dockerfile)8.1-dev-macos,8-dev-macos,dev-macos(8/Dockerfile)8.0-dev-macos(8/Dockerfile)7.4-dev-macos,7-dev-macos(7/Dockerfile)
-dev
Images with -dev tag have a few differences:
sudoallowed for all commands forwodbyuser- PHP source code available under
/usr/src/php.tar.xz PHP_FPM_CLEAR_ENVis set tonoby default- Additional packages installed: yarn
- Blackfire CLI installed
-dev-macos
Same as -dev but the default user/group wodby has uid/gid 501/20 to match the macOS default user/group ids.
Supported architectures
All images built for linux/amd64 and linux/arm64
Environment Variables
PHP and PHP-FPM configuration
The default configuration not recommended for use for production environment:
"-" - Not available for this version
Additional configuration
| Variable | Default value |
|---|---|
GIT_USER_EMAIL |
[email protected] |
GIT_USER_NAME |
wodby |
SSH_PRIVATE_KEY |
|
SSH_DISABLE_STRICT_KEY_CHECKING |
|
SSHD_GATEWAY_PORTS |
no |
SSHD_HOST_KEYS_DIR |
/etc/ssh |
SSHD_LOG_LEVEL |
INFO |
SSHD_PASSWORD_AUTHENTICATION |
no |
SSHD_PERMIT_USER_ENV |
yes |
SSHD_USE_DNS |
yes |
SSMTP_MAILHUB |
opensmtpd:25 |
SSMTP_FROM_LINE_OVERRIDE |
Yes |
SSMTP_USE_TLS |
No |
Build arguments
| Argument | Default value |
|---|---|
PHP_VER |
|
PHP_DEV |
|
WODBY_GROUP_ID |
1000 |
WODBY_USER_ID |
1000 |
Change WODBY_USER_ID and WODBY_GROUP_ID mainly for local dev version of images, if it matches with existing system
user/group ids the latter will be deleted.
PHP Extensions
You can disable extension by listing them in $PHP_EXTENSIONS_DISABLE separated by ,,
e.g. $PHP_EXTENSIONS_DISABLE=event,ds
| Extension | 8.1 | 8.0 | 7.4 |
|---|---|---|---|
| amqp | 1.11.0 | 1.11.0 | 1.11.0 |
| apcu | 5.1.21 | 5.1.21 | 5.1.21 |
| ast | 1.0.16 | 1.0.16 | 1.0.16 |
| blackfire | latest | latest | latest |
| bcmath | |||
| brotli | 0.13.1 | 0.13.1 | 0.13.1 |
| bz2 | |||
| calendar | |||
| Core | |||
| ctype | |||
| curl | |||
| date | |||
| dom | |||
| ds | 1.4.0 | 1.4.0 | 1.4.0 |
| exif | |||
| event | 3.0.6 | 3.0.6 | 3.0.6 |
| fileinfo | |||
| filter | |||
| ftp | |||
| gd | |||
| hash | |||
| iconv | |||
| igbinary | 3.2.7 | 3.2.7 | 3.2.7 |
| imagick | 3.7.0 | 3.7.0 | 3.7.0 |
| imap | |||
| intl | |||
| ioncube loader | - | - | latest |
| json | |||
| ldap | |||
| libxml | |||
| mbstring | |||
| mcrypt | - | 1.0.4 | 1.0.4 |
| memcached | 3.2.0 | 3.2.0 | 3.2.0 |
| mongodb | 1.13.0 | 1.13.0 | 1.13.0 |
| mysql | - | - | - |
| mysqli | |||
| mysqlnd | |||
| newrelic | latest | latest | latest |
| OAuth | 2.0.7 | 2.0.7 | 2.0.7 |
| openssl | |||
| pcov | latest | latest | latest |
| pcntl | |||
| pcre | |||
| PDO | |||
| pdo_mysql | |||
| pdo_pgsql | |||
| pdo_sqlite | |||
| pdo_sqlsrv* | 5.10.1 | 5.10.1 | 5.10.1 |
| pgsql | |||
| Phar | |||
| posix | |||
| rdkafka | 6.0.1 | 6.0.1 | 6.0.1 |
| readline | |||
| redis | 5.3.7 | 5.3.7 | 5.3.7 |
| Reflection | |||
| session | |||
| SimpleXML | |||
| smbclient | 1.0.6 | 1.0.6 | 1.0.6 |
| soap | |||
| sockets | |||
| sodium | |||
| SPL | |||
| sqlite3 | |||
| sqlsrv* | 5.10.1 | 5.10.1 | 5.10.1 |
| standard | |||
| tidy | |||
| tokenizer | |||
| uploadprogress | 2.0.2 | 2.0.2 | 2.0.2 |
| uuid | 1.2.0 | 1.2.0 | 1.2.0 |
| xdebug | 3.1.5 | 3.1.5 | 3.1.5 |
| xhprof | 2.3.5 | 2.3.5 | 2.3.5 |
| xml | |||
| xmlreader | |||
| xmlrpc | - | - | |
| xmlwriter | |||
| xsl | |||
| yaml | 2.2.2 | 2.2.2 | 2.2.2 |
| Zend OPcache | |||
| zip | |||
| zlib |
Legend:
- [EMPTY] – Core PHP extension
- "-" - Not exists in this version > Some extensions may not be available in
-devimages
Extensions xdebug, blackfire and xhprof disabled by default.
- sqlsrv extension has no arm64 support because the driver has no support for linux/arm64
Tools
| Tool | 8.1 | 8.0 | 7.4 |
|---|---|---|---|
| Composer | latest | latest | latest |
| Blackfire CLI | 2.10.0 | 2.10.0 | 2.10.0 |
Xdebug
By default, xdebug extension not loaded to avoid any performance impact. Set PHP_XDEBUG env var to any value to load
it and set PHP_XDEBUG_MODE to the appropriate value (by default off – disabled) to enable xdebug.
Changelog
Changes per stability tag reflected in git tags description under releases.
Crond
You can run Crond with this image changing the command to sudo -E crond -f -d 0 and mounting a crontab file
to ./crontab:/etc/crontabs/www-data. Example crontab file contents:
# min hour day month weekday command
*/1 * * * * echo "test" > /mnt/files/cron
SSHD
You can run SSHD with this image by changing the command to sudo /usr/sbin/sshd -De and mounting authorized public
keys to /home/wodby/.ssh/authorized_keys
Adding SSH key
You can add a private SSH key to the container by mounting it to /home/wodby/.ssh/id_rsa
Users and permissions
Default container user is wodby:wodby (UID/GID 1000). PHP-FPM runs from www-data:www-data user (UID/GID 82) by
default. User wodby is a part of www-data group.
Codebase volume $APP_ROOT (/var/www/html) owned by wodby:wodby. Files volume $FILES_DIR (/mnt/files) owned
by www-data:www-data with 775 mode.
See https://github.com/wodby/php/issues/22 for more details.
Helper scripts
-
files_chmod– in case you need write access forwodbyuser to a file/dir generated bywww-dataon this volume runsudo files_chmod [FILEPATH]script (FILEPATH must be under/mnt/files), it will recursively change the mode toug=rwX,o=rX -
files_chown– in case you manually uploaded files underwodbyuser to files volume and want to change the ownership of those files towww-datarunsudo files_chown [FILEPATH]script (FILEPATH must be under/mnt/files), it will recursively change ownership towww-data:www-data
Complete PHP-based stacks
Images based on wodby/php
- wodby/drupal-php
- wodby/wordpress-php
- wodby/adminer
- wodby/matomo
- wodby/cachet
- wodby/webgrind
- wodby/xhprof
Orchestration Actions
Usage:
make COMMAND [params ...]
commands:
migrate
check-ready [host max_try wait_seconds delay_seconds]
git-clone url [branch]
git-checkout target [is_hash]
files-import source
files-link public_dir
update-keys
walter
default params values:
is_hash 0
branch "" Branch, tag or hash commit