Noor
Noor

Reputation: 20130

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 ?

I checked the answere here but it doesn't answer my question

Upvotes: 1

Views: 1382

Answers (1)

KeepCalmAndCarryOn
KeepCalmAndCarryOn

Reputation: 9075

There are a couple of things to try:

Squash newly built layers into a single new layer

With multi-stage builds, you use multiple FROM statements in your Dockerfile. Each FROM instruction can use a different base, and each of them begins a new stage of the build. You can selectively copy artifacts from one stage to another, leaving behind everything you don’t want in the final image.

Upvotes: 2

Related Questions