mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Remove Daemon.setHostConfig
The container's constructor, Daemon.newContainer, already has hostConfig and can just assign it directly. Signed-off-by: Rob Murray <rob.murray@docker.com>
This commit is contained in:
@@ -143,7 +143,7 @@ func (daemon *Daemon) newContainer(name string, platform ocispec.Platform, confi
|
||||
base.Path = entrypoint
|
||||
base.Args = args // FIXME: de-duplicate from config
|
||||
base.Config = config
|
||||
base.HostConfig = &containertypes.HostConfig{}
|
||||
base.HostConfig = hostConfig
|
||||
base.ImageID = imgID
|
||||
base.NetworkSettings = &network.Settings{}
|
||||
base.Name = name
|
||||
@@ -211,14 +211,6 @@ func (daemon *Daemon) setSecurityOptions(cfg *config.Config, container *containe
|
||||
return daemon.parseSecurityOpt(cfg, &container.SecurityOptions, hostConfig)
|
||||
}
|
||||
|
||||
func (daemon *Daemon) setHostConfig(container *container.Container, hostConfig *containertypes.HostConfig) error {
|
||||
container.Lock()
|
||||
defer container.Unlock()
|
||||
|
||||
container.HostConfig = hostConfig
|
||||
return nil
|
||||
}
|
||||
|
||||
// verifyContainerSettings performs validation of the hostconfig and config
|
||||
// structures.
|
||||
func (daemon *Daemon) verifyContainerSettings(daemonCfg *configStore, hostConfig *containertypes.HostConfig, config *containertypes.Config, update bool) (warnings []string, _ error) {
|
||||
|
||||
@@ -225,7 +225,6 @@ func (daemon *Daemon) create(ctx context.Context, daemonCfg *config.Config, opts
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ctr.HostConfig.StorageOpt = opts.params.HostConfig.StorageOpt
|
||||
ctr.ImageManifest = imgManifest
|
||||
|
||||
// Set RWLayer for container after mount labels have been set
|
||||
@@ -244,9 +243,6 @@ func (daemon *Daemon) create(ctx context.Context, daemonCfg *config.Config, opts
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := daemon.setHostConfig(ctr, opts.params.HostConfig); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := daemon.registerLinks(ctr); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user