0

I have this requirement at my work. Consider A, B, C as individual images.

B from A

C from B
C from A

  1. Is it possible to do this scenario in the docker file
  2. If possible, can we build an image without duplicates or increasing the image size.
Red Ant
  • 315
  • 4
  • 17
  • Yes, what you want to do seems to be possible in `docker`, but what is the purpose of `C from A` as you already have `B from A` and C already inherit from B? Those links could help you : https://stackoverflow.com/questions/52701772/how-to-implement-dockerfile-inheritance and https://stackoverflow.com/questions/52701772/how-to-implement-dockerfile-inheritance – Harry Coder Nov 13 '21 at 15:08
  • Are you trying to combine `A` and `B` into a single image `C`; in which case, no, that's not possible ([Docker: Combine multiple images](https://stackoverflow.com/questions/27214757/docker-combine-multiple-images))? If `B` is `FROM A` already, can you just declare C's Dockerfile to be `FROM B`? Can you give a more concrete example of what you're hoping to get out? – David Maze Nov 13 '21 at 15:34
  • hi Harry David, Here is more context. Our company's central security team releases a base image with the latest security patch every month, which is expected to be used by all teams running Docker. We have our own custom base image. So far we have been doing it this way `custom base image from security base image` and `component image from custom base image`. However recently the security team has solved it in a dynamic way – Red Ant Nov 13 '21 at 15:44
  • so our requirement is to inherit the security base image to both the customer base image and the component image because we want to address security issues both in `custom base` and `component image` – Red Ant Nov 13 '21 at 15:48

0 Answers0