github.com/toplink-cn/moby@v0.0.0-20240305205811-460b4aebdf81/daemon/configs.go (about)

     1  package daemon // import "github.com/docker/docker/daemon"
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/containerd/log"
     7  	swarmtypes "github.com/docker/docker/api/types/swarm"
     8  )
     9  
    10  // SetContainerConfigReferences sets the container config references needed
    11  func (daemon *Daemon) SetContainerConfigReferences(name string, refs []*swarmtypes.ConfigReference) error {
    12  	if !configsSupported() && len(refs) > 0 {
    13  		log.G(context.TODO()).Warn("configs are not supported on this platform")
    14  		return nil
    15  	}
    16  
    17  	c, err := daemon.GetContainer(name)
    18  	if err != nil {
    19  		return err
    20  	}
    21  	c.ConfigReferences = append(c.ConfigReferences, refs...)
    22  	return nil
    23  }