github.com/ilhicas/nomad@v0.11.8/drivers/docker/driver_default.go (about) 1 //+build !windows 2 3 package docker 4 5 import ( 6 "github.com/docker/docker/oci/caps" 7 docker "github.com/fsouza/go-dockerclient" 8 ) 9 10 func getPortBinding(ip string, port string) []docker.PortBinding { 11 return []docker.PortBinding{{HostIP: ip, HostPort: port}} 12 } 13 14 func tweakCapabilities(basics, adds, drops []string) ([]string, error) { 15 // Moby mixes 2 different capabilities formats: prefixed with "CAP_" 16 // and not. We do the conversion here to have a consistent, 17 // non-prefixed format on the Nomad side. 18 for i, cap := range basics { 19 basics[i] = "CAP_" + cap 20 } 21 22 effectiveCaps, err := caps.TweakCapabilities(basics, adds, drops, nil, false) 23 if err != nil { 24 return effectiveCaps, err 25 } 26 27 for i, cap := range effectiveCaps { 28 effectiveCaps[i] = cap[len("CAP_"):] 29 } 30 return effectiveCaps, nil 31 }