PHP with additional scripts and preinstalled modules
10K+
This images based on official php alpine images, but, contains several scripts that can be customized with environment variables and additional installed extensions: decimal, zip, pdo, pdo_pgsql, intl, amqp, psr, bcmath, redis, apcu, pcntl, grpc, protobuf, xdebug, gd, sockets, amqp, psr, blackfire.
7.4.15-alpine-comp2 7.4-alpine-comp2 7-alpine-comp2 7.4.15-alpine alpine-comp2 7.4-alpine 7-alpine 7-comp2 latest alpine 7
7.4.15-fpm-alpine-comp2 7.4-fpm-alpine-comp2 7-fpm-alpine-comp2 7.4.15-fpm-alpine fpm-alpine-comp2 7.4-fpm-alpine 7-fpm-alpine fpm-alpine
7.4.15-alpine-comp1 7.4-alpine-comp1 7-alpine-comp1 alpine-comp1 7-comp1
7.4.15-fpm-alpine-comp1 7.4-fpm-alpine-comp1 7-fpm-alpine-comp1 fpm-alpine-comp1
7.3.27-alpine-comp2 7.3-alpine-comp2 7.3.27-alpine 7.3-alpine
7.3.27-fpm-alpine-comp2 7.3-fpm-alpine-comp2 7.3.27-fpm-alpine 7.3-fpm-alpine
7.3.27-fpm-alpine-comp1 7.3-fpm-alpine-comp1
7.3.27-alpine-comp1 7.3-alpine-comp1
Dockerfile in your PHP projectFROM akel/php:7.4.15-alpine
COPY . /usr/src/myapp
WORKDIR /usr/src/myapp
CMD [ "php", "./your-script.php" ]
Then, run the commands to build and run the Docker image:
$ docker build -t my-php-app .
$ docker run -it --rm --name my-running-app my-php-app
For many simple, single file projects, you may find it inconvenient to write a complete Dockerfile. In such cases, you can run a PHP script by using the PHP Docker image directly:
$ docker run -it --rm --name my-running-script -v "$PWD":/usr/src/myapp -w /usr/src/myapp php:7.4-cli php your-script.php
BLACKFIRE_ENABLE - set true for enable blackfire php probe
BLACKFIRE_AGENT_URL - set fqdn name or ip address of blackfire agent. Default: 127.0.0.1. Applies only when the value of the variable BLACKFIRE_ENABLE is set to true.
BLACKFIRE_AGENT_PORT - set port of blackfire agent. Default: 8707. Applies only when the value of the variable BLACKFIRE_ENABLE is set to true.
BLACKFIRE_LOG_LEVEL - set log level from 1 to 4. Default: 1. Applies only when the value of the variable BLACKFIRE_ENABLE is set to true.
BLACKFIRE_LOG_FILE - set log file for blackfire. Default /dev/null. Applies only when the value of the variable BLACKFIRE_ENABLE is set to true.
ENV_SYMLINK_ENABLE - set true if need to create symlink to env file. May be helpfull if you use vault injector with kubernetes.
ENV_SYMLINK_SRC - set source path for .env file. Default /vault/secrets/env. Applies only when the value of the variable ENV_SYMLINK_ENABLE is set to true.
ENV_SYMLINK_DST - set destination of .env file. Default /app/.env. Applies only when the value of the variable ENV_SYMLINK_ENABLE is set to true.
PHP_CRONTABS_PATH - set path to crontab include.
PHP_COMMAND_RUN - set true if need to run additional command.
PHP_COMMAND - set full command to run. Applies only when the value of the variable PHP_COMMAND_RUN is set to true.
SUPERVISORD_PATH - set path to supervisord config.
PHP_INI_PATH - set path to ini file.
PHP_POOL_PATH - set path to php pool config.
PHP_BOOT_SCRIPTS - set path to custom scripts what will be run at startup.
XDEBUG_ENABLE - set true if you want to enable xdebug php module
Must be set all of variables:
PHP_USER - set php user name.
PHP_UID - set php user id.
PHP_GID - set php user group id.
PHP_HOME - set homedir for php user.
akel/php:<version>-alpineThis variant contains the PHP CLI tool with default mods. If you need a web server, this is probably not the image you are looking for. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as a base from which to build other images.
It also is the only variant which contains the (not recommended) php-cgi binary, which is likely necessary for some things like PPM.
Note that all variants of php contain the PHP CLI (/usr/local/bin/php).
akel/php:<version>-fpmThis variant contains PHP-FPM, which is a FastCGI implementation for PHP. See the PHP-FPM website for more information about PHP-FPM.
In order to use this image variant, some kind of reverse proxy (such as NGINX, Apache, or other tool which speaks the FastCGI protocol) will be required.
Some potentially helpful resources:
akel/php:<version>-comp(1|2)This option indicates which version of composer is preinstalled. If image tag doesn't contains the comp1 or comp2 substring it's mean image have a composer v2
Content type
Image
Digest
sha256:284ef4414…
Size
285 MB
Last updated
almost 4 years ago
docker pull akel/php