github.com/Heebron/moby@v0.0.0-20221111184709-6eab4f55faf7/daemon/secrets.go (about)

     1  package daemon // import "github.com/docker/docker/daemon"
     2  
     3  import (
     4  	swarmtypes "github.com/docker/docker/api/types/swarm"
     5  	"github.com/sirupsen/logrus"
     6  )
     7  
     8  // SetContainerSecretReferences sets the container secret references needed
     9  func (daemon *Daemon) SetContainerSecretReferences(name string, refs []*swarmtypes.SecretReference) error {
    10  	if !secretsSupported() && len(refs) > 0 {
    11  		logrus.Warn("secrets are not supported on this platform")
    12  		return nil
    13  	}
    14  
    15  	c, err := daemon.GetContainer(name)
    16  	if err != nil {
    17  		return err
    18  	}
    19  
    20  	c.SecretReferences = refs
    21  
    22  	return nil
    23  }