1

Hello Docker Community,

I’m facing an issue when updating a shared postgres:16 image used by multiple containers. Here’s the problem:

Scenario:

  • Multiple containers rely on the same postgres:16 image.
  • When I update one container via docker-compose up, the new image is pulled if an update is available, and the old one becomes <none> and is still in use by other containers.
  • Result: Other containers still reference the old (now untagged) image, leading to inconsistency.
  • docker compose file:
 name: ${DOCKER_NAME} services: main: container_name: ${DOCKER_NAME} image: postgres:16 

Problem Statement

  1. This creates disk space issues as I'm essentially duplicating images on my system
  2. I can't remove these dangling images because they're still being used by running containers
  3. The containers using the old image continue running with it, not benefiting from the updates in the new image

Questions:

  • How do others manage shared base images across multiple containers?
  • Are there best practices to prevent legacy containers from referencing untagged images?

Has anyone solved this problem elegantly? I'd appreciate any guidance on best practices or tools that could help automate this process while minimizing service disruption.

Thank you!

2
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Commented Feb 27 at 11:23
  • What are "multiple containers"? Multiple in the same Compose file? I see only one. Single Compose running multiple times? Please be more specific as to the use case. Commented Feb 27 at 18:22

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.