buildx icon indicating copy to clipboard operation
buildx copied to clipboard

docker-container: restart-policy opt

Open crazy-max opened this issue 1 year ago • 1 comments

Currently we can't set the restart policy for buildkit containers created with docker-container driver. In my use case I have restarted some machines but as the default restart policy is no, the containers were not running. Even if we ensure nodes are booted before building I think it's still useful to have this driver opt.

I keep the current default behavior but I think we could set always by default. WDYT?

Signed-off-by: CrazyMax [email protected]

crazy-max avatar Aug 14 '22 06:08 crazy-max

LGTM.

Personally, not sure about defaulting to always, I quite like the default lazy behavior with restart-policy=no, since I can sometimes have a lot of builders, which might not all actually be running. But, also, this would then match the kubernetes driver behavior, where the replicas are always running. If we do switch the default, we should default to unless-stopped I think, since buildx stop will stop the container, which then shouldn't automatically restart.

jedevc avatar Aug 16 '22 09:08 jedevc

If we do switch the default, we should default to unless-stopped I think, since buildx stop will stop the container, which then shouldn't automatically restart.

Good point for unless-stopped, tbf I never used buildx stop and didn't recall it ever exists :sweat_smile:

crazy-max avatar Aug 16 '22 12:08 crazy-max

PTAL @tonistiigi

crazy-max avatar Aug 18 '22 10:08 crazy-max

Needs rebase

AkihiroSuda avatar Nov 15 '22 02:11 AkihiroSuda

What is the use case for this? In what case would the user need to change this? Running a builder takes resources and memory so if it is not being used it is better if it is not running.

tonistiigi avatar Feb 14 '23 00:02 tonistiigi

What is the use case for this? In what case would the user need to change this? Running a builder takes resources and memory so if it is not being used it is better if it is not running.

@tonistiigi Main use case is for the Build UI in Docker Desktop so I can see my build history without needing to start my builders.

crazy-max avatar Feb 06 '24 10:02 crazy-max