Is it possible to reuse an Image? #1178
-
Hi, In my project I have the Dockerfile to build the image to use to run some integration tests. Something like: `
` Then every time I run a test with the given image is created and I found in my system a new integration_test_image:latest and the old image renamed to : Is there some way to avoid creating the new image if there is an image already present with the same name and version? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You can configure the behavior with the following API: WithImageBuildPolicy(Func<ImageInspectResponse, bool>) By default, the builder always builds the image. You can either use the existing pull policy predicate: WithImageBuildPolicy(PullPolicy.Missing) or use your own: WithImageBuildPolicy(cachedImage => cachedImage == null) I noticed that this API is not mentioned in the docs. I will update it later. |
Beta Was this translation helpful? Give feedback.
-
Yes, that's make the trick... Thanks! |
Beta Was this translation helpful? Give feedback.
You can configure the behavior with the following API:
By default, the builder always builds the image. You can either use the existing pull policy predicate:
or use your own:
I noticed that this API is not mentioned in the docs. I will update it later.