Merge pull request #20774 from hqhq/hq_vender_engine_api
Vendor engine-api to 70d266e96080e3c3d63c55a4d8659e00ac1f7e6c Upstream-commit: b211e57f23848bd1990db84d2ccce0ce529e735a Component: engine
This commit is contained in:
@@ -70,8 +70,8 @@ func merge(userConf, imageConf *containertypes.Config) error {
|
||||
userConf.Labels = imageConf.Labels
|
||||
}
|
||||
|
||||
if userConf.Entrypoint.Len() == 0 {
|
||||
if userConf.Cmd.Len() == 0 {
|
||||
if len(userConf.Entrypoint) == 0 {
|
||||
if len(userConf.Cmd) == 0 {
|
||||
userConf.Cmd = imageConf.Cmd
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ func (daemon *Daemon) Commit(name string, c *types.ContainerCommitConfig) (strin
|
||||
h := image.History{
|
||||
Author: c.Author,
|
||||
Created: time.Now().UTC(),
|
||||
CreatedBy: strings.Join(container.Config.Cmd.Slice(), " "),
|
||||
CreatedBy: strings.Join(container.Config.Cmd, " "),
|
||||
Comment: c.Comment,
|
||||
EmptyLayer: true,
|
||||
}
|
||||
|
||||
@@ -257,8 +257,8 @@ func (daemon *Daemon) populateCommand(c *container.Container, env []string) erro
|
||||
AllowedDevices: allowedDevices,
|
||||
AppArmorProfile: c.AppArmorProfile,
|
||||
AutoCreatedDevices: autoCreatedDevices,
|
||||
CapAdd: c.HostConfig.CapAdd.Slice(),
|
||||
CapDrop: c.HostConfig.CapDrop.Slice(),
|
||||
CapAdd: c.HostConfig.CapAdd,
|
||||
CapDrop: c.HostConfig.CapDrop,
|
||||
CgroupParent: defaultCgroupParent,
|
||||
GIDMapping: gidMap,
|
||||
GroupAdd: c.HostConfig.GroupAdd,
|
||||
|
||||
@@ -412,7 +412,7 @@ func (daemon *Daemon) mergeAndVerifyConfig(config *containertypes.Config, img *i
|
||||
return err
|
||||
}
|
||||
}
|
||||
if config.Entrypoint.Len() == 0 && config.Cmd.Len() == 0 {
|
||||
if len(config.Entrypoint) == 0 && len(config.Cmd) == 0 {
|
||||
return fmt.Errorf("No command specified")
|
||||
}
|
||||
return nil
|
||||
@@ -495,13 +495,11 @@ func (daemon *Daemon) generateHostname(id string, config *containertypes.Config)
|
||||
}
|
||||
}
|
||||
|
||||
func (daemon *Daemon) getEntrypointAndArgs(configEntrypoint *strslice.StrSlice, configCmd *strslice.StrSlice) (string, []string) {
|
||||
cmdSlice := configCmd.Slice()
|
||||
if configEntrypoint.Len() != 0 {
|
||||
eSlice := configEntrypoint.Slice()
|
||||
return eSlice[0], append(eSlice[1:], cmdSlice...)
|
||||
func (daemon *Daemon) getEntrypointAndArgs(configEntrypoint strslice.StrSlice, configCmd strslice.StrSlice) (string, []string) {
|
||||
if len(configEntrypoint) != 0 {
|
||||
return configEntrypoint[0], append(configEntrypoint[1:], configCmd...)
|
||||
}
|
||||
return cmdSlice[0], cmdSlice[1:]
|
||||
return configCmd[0], configCmd[1:]
|
||||
}
|
||||
|
||||
func (daemon *Daemon) newContainer(name string, config *containertypes.Config, imgID image.ID) (*container.Container, error) {
|
||||
|
||||
@@ -93,8 +93,8 @@ func (d *Daemon) ContainerExecCreate(config *types.ExecConfig) (string, error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
cmd := strslice.New(config.Cmd...)
|
||||
entrypoint, args := d.getEntrypointAndArgs(strslice.New(), cmd)
|
||||
cmd := strslice.StrSlice(config.Cmd)
|
||||
entrypoint, args := d.getEntrypointAndArgs(strslice.StrSlice{}, cmd)
|
||||
|
||||
keys := []byte{}
|
||||
if config.DetachKeys != "" {
|
||||
|
||||
Reference in New Issue
Block a user