Environment · Containers

Change the base image, then replace every running container

A container does not inherit a patched PHP because a tag moved. The running container keeps the image it started from. The reliable evidence is the digest on each replica, not the tag in the deployment file.

Reviewed 24 October 2026 Environment Docker, Kubernetes or another container runtime Official sources

Short answer

Resolve the patched PHP base image tag to a digest, and pin that digest in your build.

Rebuild the application image, deploy it, and confirm the running digest on every replica. Changing a manifest is not the same as replacing a container.

Keep the previous digest as the rollback artefact. A tag such as latest is not a rollback reference.

On this page
  1. Does this apply?
  2. Steps
  3. What goes wrong
  4. Decision questions
  5. Next
  6. Sources

01Does this apply to you?

Applies when

  • PHP runs inside a container image you build or deploy.
  • The base image is one of the official PHP images or a derivative.
  • You deploy with Docker Compose, Kubernetes, ECS or another orchestrator.

Does not cover

  • It does not cover a PHP runtime installed directly on the host; use the main patch guide.
  • It does not scan the image for other vulnerabilities.
  • It does not guarantee that an orchestrator has drained all old replicas; that needs verification.

What you need before starting

  • The Dockerfile or build definition and the base image reference.
  • Registry access to resolve and pull the patched image.
  • The deployment configuration and permission to roll out and roll back.
  • A way to inspect the running image digest per replica.

02Steps

Treat the base image as the runtime. Find it, pin it, rebuild, replace, and verify the running digest rather than the declared tag.

  1. Platform engineer

    Find the image that provides PHP

    Look for the FROM line that supplies PHP, not the line that copies application code. A multi-stage build can hide the runtime in an earlier stage; follow the final stage's base.

    Check whether the image is the official php image, a framework image built on it, or a vendor image with PHP baked in. The fix must come from a rebuilt base, not from a PHP package installed at container start.

    List every workload that uses the image: web, queue workers, cron jobs, one-off admin tasks and init containers. Some of them may run PHP even if they do not serve HTTP.

    You should see Every workload is mapped to the image that supplies its PHP runtime.
    If it fails If a workload builds PHP at startup, it is not reproducible and cannot be verified by digest. Record it as an exception and fix the build.
  2. Platform engineer

    Resolve the patched tag to a digest

    The official PHP image feed lists 8.2.35, 8.3.36, 8.4.27 and 8.5.12. A tag existing does not prove a running container uses it, and tags can be moved.

    A tag can point to a manifest list (index) for several platforms, not to one image. docker buildx imagetools inspect shows the index digest and a digest for each platform manifest. Record both, and record the target architecture and variant.

    Pin the platform-specific manifest digest in the build input for the architecture you deploy. Keep the index digest as distribution metadata, not as a substitute for the platform digest.

    Resolve a tag to a digest (example)
    docker buildx imagetools inspect php:8.4.27-fpm   # record index and per-platform manifest digests
    You should see A version, tag, index digest, target-platform manifest digest and architecture are recorded for the patched base image.
    If it fails If the registry cannot resolve the tag, check the image variant and architecture. Do not substitute a different variant just to get a digest, and do not call the index digest a platform image digest.
  3. Platform engineer

    Rebuild the application image on the patched base

    Update the FROM reference to the patched digest and rebuild. Pin the digest in the build definition so a later tag move cannot silently change the runtime.

    Run the application's own build and test steps. A base image change can affect extensions, ICU data, OpenSSL or the default php.ini; these are common sources of production surprises.

    Record the previous image digest before overwriting it. If your registry deletes old tags, keep the digest or export the image.

    You should see A new application image built from the patched base, with the previous digest retained.
    If it fails If the build depends on an unpinned base or a floating latest, fix the build definition first. Otherwise the next deployment can undo this one.
  4. Platform engineer

    Deploy and drain the old replicas

    Roll out the new image using your normal strategy. Make sure the orchestrator terminates old replicas rather than leaving them attached to the service.

    Check connection draining and grace periods. A PHP-FPM container can finish in-flight requests after the orchestrator starts the new replica; that is expected, but it must not keep taking new traffic indefinitely.

    For a single Docker host, stop and remove the old container and create a new one from the new image. docker restart reuses the existing container image and is not a runtime change.

    You should see Only the new image is receiving new traffic, and old replicas are terminating or gone.
    If it fails If old replicas remain, inspect the deployment's rollout status and the service selector. A manifest update that did not trigger a rollout is a common cause.
  5. Platform engineer

    Confirm the running application image, at the right layer

    Three identifiers are involved, and they are not interchangeable. The base image digest is a build input. The rebuilt application image has its own local image ID and, after a push or pull, its own repository manifest digest. The running container records the image it was created from. A rebuilt app image is a different object from its base, so their hashes will not match.

    On current engines, docker inspect --format '{{.Image}}' <container> returns the image ID used at creation; newer API output also exposes .ImageID and, when available, .ImageManifestDescriptor for the platform-specific manifest. Compare that with the application image ID from docker image inspect --format '{{.Id}}' app:local. Compare image ID with image ID, not with a registry digest.

    If the application image was pulled or pushed, docker image inspect --format '{{index .RepoDigests 0}}' app:local gives a repository-level manifest digest such as registry.example/app@sha256:…. For a multi-platform app image, use the manifest digest for the platform the container runs on, and keep the index digest separately. A lengthened short ID is not a repository digest.

    This evidence proves which application artifact is deployed. It does not prove which PHP patch is inside it. Pair it with the build log, base manifest digest, package source and regression result.

    Compare the running container with the application image (example)
    docker inspect --format '{{.Image}}' <container>
    docker image inspect --format '{{.Id}}' app:local
    docker image inspect --format '{{index .RepoDigests 0}}' app:local
    You should see The running image ID matches the expected application image ID; any repository digest and platform manifest are recorded at their own layer. Separate build evidence shows which PHP patch the application image contains.
    If it fails If .Image is a tag or a short ID, resolve it without treating it as a repository digest. On newer engines check .ImageID. Do not compare the base image digest with the application image ID and call a mismatch a failed rollout.
  6. Application owner

    Run the business regression and keep the rollback

    Test the same critical paths as any other runtime change: authentication, the primary transaction, uploads, queues and scheduled work. A container that starts is not a container that works.

    Record the previous digest, the new digest and the rollback command in the change record. Rehearse the rollback if the service is critical.

    Remove unused old images only after the rollback window closes. Disk pressure is not a reason to delete the only rollback artefact.

    You should see A regression result, a rollback digest and a date when the old image can be retired.
    If it fails If the rollback fails in rehearsal, treat the deployment as unverified and fix the rollback before closing the change.

03What usually goes wrong

Moving a tag without rebuilding

A running container keeps the image it started from. Pulling a new tag does not change a running container, and a manifest update may not trigger a rollout.

Using `latest` in production

latest gives you no version, no digest and no reliable rollback. Pin a version and resolve it to a digest.

Checking the deployment, not the pod

The deployment spec can show the new image while an old pod is still serving. Check the running digest on each replica.

Forgetting non-web containers

Queue workers, cron containers and init containers can run PHP too. They may not serve HTTP, but they belong in the inventory and the change record.

Comparing a base image digest with an app image ID

They identify different objects. A rebuilt application image will not have the base image's hash; compare the running container's image ID with the application image ID you built.

Stretching a short ID into a repository digest

A short image ID is a local identifier, not a registry manifest digest. Resolve the image and read RepoDigests, or inspect the platform manifest through the registry, rather than padding the short string.

04Questions that change the decision

Do I need to rebuild if I only changed the base image tag?

Yes. The application image is built on the base. Rebuild, push, deploy, and verify the running digest. A tag change in a manifest without a rebuild can leave the application image unchanged.

Are PHP CLI containers affected?

The advisories target web request handling. Queue and cron containers do not serve HTTP, but they run the same application code and may hold the same credentials. Patch them as part of the same change and record them separately.

Can we keep the old image for rollback?

Keep it until the verification and rollback window close. Record the digest, not only the tag, and check that your registry retention has not deleted it.

Why do the base and application image digests not match?

The base image is a build input; the application image is a new image with its own configuration and layers. The correct comparison is running container image ID against the application image ID you built. If you distribute the app image, compare its repository manifest digest at the same platform layer.

05Where to go next

06Sources and revision

Every operational claim on this page was checked against the documents below on 24 October 2026. This page was last substantively changed on 24 October 2026.

Primary sources used for this page
PublisherDocumentChecked
Docker Official Images / php-src packaging Official PHP image versions feed Published date not stated 2026-10-23
PHP Group Security advisory: Critical remote code execution vulnerabilities, update now Published 2026-10-21 2026-10-24
PHP Group PHP 8 ChangeLog (8.5.12, 8.4.27, 8.3.36, 8.2.35) Published 2026-10-22 2026-10-23
Cloudflare PHP vulnerabilities: WAF protection and what customers should do Published 2026-10-21 2026-10-23
PHP Group Informational advisory: Session upload progress Published 2026-10-23 2026-10-23
Docker Docs Docker image digests Published date not stated 2026-10-24
Docker Docs Building multi-platform images Published date not stated 2026-10-24
Docker / Moby Docker Engine API: container and image inspect fields Published date not stated 2026-10-24

See the full revision log for what changed on this site.