зеркало из https://github.com/microsoft/docker.git
Update CAP_ prefix for new spec format
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Родитель
d0fdc3b5df
Коммит
f6064cb42b
|
@ -65,7 +65,13 @@ func (d *Driver) createContainer(ctx context.Context, c *execdriver.Command, hoo
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// add CAP_ prefix to all caps for new libcontainer update to match
|
||||||
|
// the spec format.
|
||||||
|
for i, s := range container.Capabilities {
|
||||||
|
if !strings.HasPrefix(s, "CAP_") {
|
||||||
|
container.Capabilities[i] = fmt.Sprintf("CAP_%s", s)
|
||||||
|
}
|
||||||
|
}
|
||||||
container.AdditionalGroups = c.GroupAdd
|
container.AdditionalGroups = c.GroupAdd
|
||||||
|
|
||||||
if c.AppArmorProfile != "" {
|
if c.AppArmorProfile != "" {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/docker/docker/context"
|
"github.com/docker/docker/context"
|
||||||
|
@ -36,6 +37,13 @@ func (d *Driver) Exec(ctx context.Context, c *execdriver.Command, processConfig
|
||||||
if processConfig.Privileged {
|
if processConfig.Privileged {
|
||||||
p.Capabilities = execdriver.GetAllCapabilities()
|
p.Capabilities = execdriver.GetAllCapabilities()
|
||||||
}
|
}
|
||||||
|
// add CAP_ prefix to all caps for new libcontainer update to match
|
||||||
|
// the spec format.
|
||||||
|
for i, s := range p.Capabilities {
|
||||||
|
if !strings.HasPrefix(s, "CAP_") {
|
||||||
|
p.Capabilities[i] = fmt.Sprintf("CAP_%s", s)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
config := active.Config()
|
config := active.Config()
|
||||||
if err := setupPipes(&config, processConfig, p, pipes); err != nil {
|
if err := setupPipes(&config, processConfig, p, pipes); err != nil {
|
||||||
|
|
|
@ -119,6 +119,5 @@ func TweakCapabilities(basics, adds, drops []string) ([]string, error) {
|
||||||
newCaps = append(newCaps, strings.ToUpper(cap))
|
newCaps = append(newCaps, strings.ToUpper(cap))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return newCaps, nil
|
return newCaps, nil
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче