Wait for container dependencies upon daemon start up

- Get dependent containers before starting containers
- Dependent containers can be either from legacy link or container network
- Wait on a best effort basis for the dependent containers

Fixes: #50326

Signed-off-by: Adrien Pompée <adrien.pompee@atmosphere.aero>
This commit is contained in:
Adrien Pompée
2025-07-04 17:44:29 +02:00
parent c616e7690f
commit d4e026fe20
2 changed files with 32 additions and 2 deletions

View File

@@ -575,8 +575,8 @@ func (daemon *Daemon) restore(cfg *configStore) error {
logger.Debug("starting container")
// ignore errors here as this is a best effort to wait for children
// (legacy links) to be running before we try to start the container
if children := daemon.linkIndex.children(c); len(children) > 0 {
// (legacy links or container network) to be running before we try to start the container
if children := daemon.GetDependentContainers(c); len(children) > 0 {
timeout := time.NewTimer(5 * time.Second)
defer timeout.Stop()