github.com/niusmallnan/moby@v1.13.1/daemon/secrets.go (about)

     1  package daemon
     2  
     3  import (
     4  	"github.com/Sirupsen/logrus"
     5  	swarmtypes "github.com/docker/docker/api/types/swarm"
     6  	"github.com/docker/swarmkit/agent/exec"
     7  )
     8  
     9  // SetContainerSecretStore sets the secret store backend for the container
    10  func (daemon *Daemon) SetContainerSecretStore(name string, store exec.SecretGetter) error {
    11  	c, err := daemon.GetContainer(name)
    12  	if err != nil {
    13  		return err
    14  	}
    15  
    16  	c.SecretStore = store
    17  
    18  	return nil
    19  }
    20  
    21  // SetContainerSecretReferences sets the container secret references needed
    22  func (daemon *Daemon) SetContainerSecretReferences(name string, refs []*swarmtypes.SecretReference) error {
    23  	if !secretsSupported() && len(refs) > 0 {
    24  		logrus.Warn("secrets are not supported on this platform")
    25  		return nil
    26  	}
    27  
    28  	c, err := daemon.GetContainer(name)
    29  	if err != nil {
    30  		return err
    31  	}
    32  
    33  	c.SecretReferences = refs
    34  
    35  	return nil
    36  }