Add lock for container update
Container needs to be locked when updating the fields, and this PR also remove the redundant `parseSecurityOpt` since it'll be done in `setHostConfig`. Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
This commit is contained in:
parent
a16a1d75d9
commit
464eefd795
2 changed files with 2 additions and 6 deletions
|
@ -545,6 +545,8 @@ func (container *Container) StopSignal() int {
|
|||
// See https://github.com/docker/docker/pull/17779
|
||||
// for a more detailed explanation on why we don't want that.
|
||||
func (container *Container) InitDNSHostConfig() {
|
||||
container.Lock()
|
||||
defer container.Unlock()
|
||||
if container.HostConfig.DNS == nil {
|
||||
container.HostConfig.DNS = make([]string, 0)
|
||||
}
|
||||
|
|
|
@ -30,12 +30,6 @@ func (daemon *Daemon) ContainerStart(name string, hostConfig *runconfig.HostConf
|
|||
// creating a container, not during start.
|
||||
if hostConfig != nil {
|
||||
logrus.Warn("DEPRECATED: Setting host configuration options when the container starts is deprecated and will be removed in Docker 1.12")
|
||||
container.Lock()
|
||||
if err := parseSecurityOpt(container, hostConfig); err != nil {
|
||||
container.Unlock()
|
||||
return err
|
||||
}
|
||||
container.Unlock()
|
||||
if err := daemon.adaptContainerSettings(hostConfig, false); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue