We use a variety of PHP containers at Sykes Cottages across most of our platforms, but due to a lot of bespoke requirements in our applications using the official PHP images typically required a monalithic Dockerfile to support the application. All of our PHP images are based off the Base Sykes image which uses the official Ubuntu Docker image. We opted for this path to utilise aptitude so we could manage packages easier and utilise the package integrity verification that comes with apititude.
Pulling an image:
docker pull sykescottages/php:version
Running an container:
docker run -i -t sykescottages/php:version
Building from this image simply reference it as part of your Dockerfile:
FROM sykescottages/php:version
# ... Your configuration
All images come with composer installed, but by default they all use version 1 which stops legacy composer builds from failing. To replace composer or use a specific version of composer you will need to extend this image and create a multi-stage build Dockerfile e.g.
FROM sykescottages/php:7.4-cli
COPY --from=composer /usr/bin/composer /usr/bin/composer
All our images have support for:
linux/amd64
linux/arm64/v8
Obtaining platform specific architectures:
docker pull --platform=<ARCHITECTURE> sykescottages/php:<VERSION>
Testing you have the right architecture:
docker run -it --platform=<ARCHITECTURE> sykescottages/php:<VERSION> arch
- 5.6.40 cli (Deprecated) -
sykescottages/php:5.6-cli
- 5.6.40 fpm (Deprecated) -
sykescottages/php:5.6-fpm
- 7.0.33 cli (Deprecated) -
sykescottages/php:7.0-cli
- 7.0.33 fpm (Deprecated) -
sykescottages/php:7.0-fpm
- 7.1.33 cli (Deprecated) -
sykescottages/php:7.1-cli
- 7.1.33 fpm (Deprecated) -
sykescottages/php:7.1-fpm
- 7.2.34 cli (Deprecated) -
sykescottages/php:7.2-cli
- 7.2.34 fpm (Deprecated) -
sykescottages/php:7.2-fpm
- 7.3.33 cli (Deprecated) -
sykescottages/php:7.3-cli
- 7.3.33 fpm (Deprecated) -
sykescottages/php:7.3-fpm
- 7.4.33 cli (Deprecated) -
sykescottages/php:7.4-cli
- 7.4.33 fpm (Deprecated) -
sykescottages/php:7.4-fpm
- 8.0.30 cli (Deprecated) -
sykescottages/php:8.0-cli
- 8.0.30 fpm (Deprecated) -
sykescottages/php:8.0-fpm
- 8.1.30 cli (EOL 2024-11-25) -
sykescottages/php:8.1-cli
- 8.1.30 fpm (EOL 2024-11-25) -
sykescottages/php:8.1-fpm
- 8.2.24 (EOL 2025-12-08) -
sykescottages/php:8.2-cli
- 8.2.24 (EOL 2025-12-08) -
sykescottages/php:8.2-fpm
- 8.3.12 (Release Candidate) -
sykescottages/php:8.3-cli
- 8.3.12 (Release Candidate) -
sykescottages/php:8.3-fpm
- 8.4.0RC1 (Release Candidate) -
sykescottages/php:8.4-cli
- 8.4.0RC1 (Release Candidate) -
sykescottages/php:8.4-fpm
For better visibility of packages there is now an included aptitude itinerary with each tag, this is located in the corresponding folder to the tag. This will give better clarity on package version changes and be reflected in the git history.
All testing is done in the form of a SUT containers which is run by the Docker Hub (see Automated repository tests for more information) and runs a variety of shell scripts.
As these images are using the ondrej
repositories you can install extensions with aptitude e.g.
# Installation requires auto confirmation, the -q flag is optional
RUN apt-get update && \
apt-get install -y -q \
php8.0-memcache
# Good practice to reduce image size
RUN apt-get autoremove -y -q && \
apt-get autoclean -y -q && \
rm -rf /var/lib/apt/lists/*
With all images (apart from the base) there is a pre-canned set of extensions:
- bcmath
- curl
- dev
- intl
- json
- mbstring
- mysql
- soap
- xml
- zip
If you did want to remove these extensions the can be adding the following your Dockerfile
:
# Installation requires auto confirmation, the -q flag is optional
RUN apt-get remove --purge -y php8.0-mysql \
apt-get autoremove -y -q && \
apt-get autoclean -y -q
Contributions are welcome, but please adhere to the CONTRIBUTION.MD. Also, if you could ensure that there are tests with every modification of the Dockerfiles to verify that your changes work.