github.com/sijibomii/docker@v0.0.0-20231230191044-5cf6ca554647/daemon/exec_linux.go (about)

     1  package daemon
     2  
     3  import (
     4  	"github.com/docker/docker/container"
     5  	"github.com/docker/docker/daemon/caps"
     6  	"github.com/docker/docker/daemon/exec"
     7  	"github.com/docker/docker/libcontainerd"
     8  )
     9  
    10  func execSetPlatformOpt(c *container.Container, ec *exec.Config, p *libcontainerd.Process) error {
    11  	if len(ec.User) > 0 {
    12  		uid, gid, additionalGids, err := getUser(c, ec.User)
    13  		if err != nil {
    14  			return err
    15  		}
    16  		p.User = &libcontainerd.User{
    17  			UID:            uid,
    18  			GID:            gid,
    19  			AdditionalGids: additionalGids,
    20  		}
    21  	}
    22  	if ec.Privileged {
    23  		p.Capabilities = caps.GetAllCapabilities()
    24  	}
    25  	return nil
    26  }