Docker Community Forums

Share and learn in the Docker community.

Create an independent docker image from a dependent image

I have a docker image that has 13 set of modifications since its creation. For each set of modification, a new image has been created. Thus there are currently 13 image versions with the 13th one being the newest. Also, each image is dependent on the previous version. In short, the 13th version has a dependency that has recursive dependencies. How to create an complete independent image from 13th version ?

More abstractly, How to generate an independent docker image from an image that has recursive dependencies ?

It is possible to squash all image layers of a Dockerfile to a single layer, but I am uncertain if this will have an effect on the image layers from the base images it deplends on:

If this doesn’t help, I am afraid it’s not possible with docker tooling. You could always extract the layers into a folder and create a tar archive from the target folder and create an image starting from from scratch and ADD the tar archive into the root of your image. Feels a little bit messy though.