project-stacker / stacker

Build OCI images natively from a declarative format
https://stackerbuild.io
Apache License 2.0
204 stars 34 forks source link

Feat: make lxc control socket unique per container #645

Open rchincha opened 1 month ago

rchincha commented 1 month ago

Is your feature request related to a problem? Please describe.

If multiple stacker instances are invoked for the same tag/target, they may step on each other since the lxc control socket is not unique per container.

Describe the solution you'd like

Make the lxc control socket unique per container.

Describe alternatives you've considered

No response

Additional context

No response

mikemccracken commented 1 month ago

note that the simplest way to do this is probably to make the container name used for a build include some randomness.

lxc uses the lxcpath and container name to name the control socket, and nothing outside of stacker really cares what the container name is.

however for the lxcpath, stacker uses the --roots-dir argument - since this comes from the user, uniquifying it might be slightly more involved. (we could make a unique subdir, but we'd have to thread that through the stacker code)

How does it happen that two stackers use the same roots-dir argument but shouldn't conflict? in some cases, concurrent runs of stacker on the same host might have the same path for the roots-dir arg, even though they aren't actually sharing it - e.g. if they are running in separate mount ns's.