Docker Community Forums

Share and learn in the Docker community.

How to manage cache when running independent services

Hi,

I am running multiple services each in separate containers based on independent images (say Service-A and Service-B). Both images are derived from ubuntu:18.04 . Service-A has been running for weeks. I am in the process of re-building the image Service-B is based on. However, when I build the image for Service-B, the apt-get command fails with bad-gateway / dns errors. I attribute this to a stale cache, and I want to remove the ubuntu image from cache. If I were running only one service, no problem, remove the image, rebuild, and usually that fixes the problem. However, because I am still running Service-A, I cannot delete the image without halting that service. As near as I can tell the no-cache argument does not actually not-use the cache, my guess is that it can’t remove the base image autmatically anymore than I can manually.

Is there some command / workflow that will allow me to rebuild one image entirely from scratch (no-cache) without stopping a container that uses a different image if both images share a common base? Thanks for any help,

Matt