1 min read · July 23, 2017
For using these images you'll usually want to create a
Dockerfile or go further
and use Docker Compose to simplify usage of multiple containers for your application.
Dockerfile for your setup:
For images that use Alpine Linux as a base, you can create a simple Nginx container with PHP FPM in the following way:
To run a CLI PHP script:
docker run -it --rm --name my-cli-script -v "$PWD":/usr/src/myapp -w /usr/src/myapp phpearth/php php script.php
To use PHP 7.2 images just prepend the tag name with
To install additional PHP extensions, you can use our packages from the PHP.earth Alpine repository:
FROM phpearth/php:7.1-nginx RUN apk add --no-cache php7.1-libsodium php7.1-mcrypt php7.1-soap
Best practice with Docker is to use one process per container. However sometimes you want to package multiple services into a single container for various reasons: simpler deployment, simpler usage, and similar cases.
To run multiple services in a single container there are multiple ways:
A solid solution to run and customize services. It requires Python.
These images use runit because for smaller usage resources and image sizes.