I'm trying to update a docker wordpress container to include php8.4.27 from ppa:ondrej/php

I’m trying to update a docker wordpress container to include php8.4.27 from ppa:ondrej/php.

  • I installed php8.4.27 on my host Ubuntu server using add-apt-repository and apt install php8.4
  • I tried to do the same in this Dockerfile, but it could find add-apt-repository or php8.4
  • The Dockerfile below uses copies of ondrej-ubuntu-php-noble.sources and ondrej-ubuntu-php-xenial.sources from the host /etc/apt/sources.list.d folder, but I still get the following message:
    ** Package php8.4 is not available, but is referred to by another package.
  • I presume the OS in the FROM image is not noble or xenial, but cannot work out what repository to use.
FROM wordpress:7.1.3-php8.4-apache

COPY ondrej-ubuntu-php-noble.sources /etc/apt/sources.list.d/ondrej-ubuntu-php-noble.sources
COPY ondrej-ubuntu-php-xenial.sources /etc/apt/sources.list.d/ondrej-ubuntu-php-xenial.sources
RUN apt update
RUN apt -y install php8.4

Can anyone assist me please?..Phil

You can find out the base OS like this:

me@host \~ % docker run --rm --entrypoint bash wordpress:7.1.3-php8.4-apache -c "cat /etc/os-release" 
PRETTY_NAME="Debian GNU/Linux 13 (trixie)"
NAME="Debian GNU/Linux"
VERSION_ID="13"
VERSION="13 (trixie)"
VERSION_CODENAME=trixie
DEBIAN_VERSION_FULL=13.7
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

The trick is to override the entrypoint script with bash, and then use -c "shell command" to execute whatever you want. This image uses Debian 13, so the Ubuntu PPA repository probably shouldn’t be used here.

You can find out which php version comes with the image:

me@host \~ % docker run --rm --entrypoint bash wordpress:7.1.3-php8.4-apache -c "php --version"      
PHP 8.4.27 (cli) (built: Oct 21 2026 15:58:11) (NTS)
Copyright (c) The PHP Group
Built by https://github.com/docker-library/php
Zend Engine v4.4.27, Copyright (c) Zend Technologies
    with Zend OPcache v8.4.27, Copyright (c), by Zend Technologies

The tag already indicates the image comes with php 8.4, and 8.4.27 is just a patch version of it

What is the reason that you want to install the version from a third party repository?

If you are just looking for a way to fix cves of the image, you could try if Hardened Images catalog | WordPress | Images | Docker Hub is a better choice, as it will come with either zero or close to zero vulnerabilities.

Hi meyay,

I hadn’t realised that wordpress:7.1.3-php8.4-apache had been upgraded to use the latest php8.4 patch.

Rebuilding my wp-php-apache container achieved what I was searching for, and upgraded my container’s PHP to 8.4.27 (required to prevent the latest cyber-security scare).

Many thanks…Phil

Welcome!

It is an official docker image, build straight from docker’s library, so it’s likely to receive updates quickly.