mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Inherit StopSignal from Dockerfile.
Make sure the image configuration is not overriden by the default value in the `create` flag. Signed-off-by: David Calavera <david.calavera@gmail.com>
This commit is contained in:
parent
b734d0e8cc
commit
a252516ec1
3 changed files with 17 additions and 4 deletions
|
@ -89,6 +89,10 @@ func merge(userConf, imageConf *containertypes.Config) error {
|
||||||
userConf.Volumes[k] = v
|
userConf.Volumes[k] = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if userConf.StopSignal == "" {
|
||||||
|
userConf.StopSignal = imageConf.StopSignal
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5777,14 +5777,21 @@ func (s *DockerSuite) TestBuildNullStringInAddCopyVolume(c *check.C) {
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildStopSignal(c *check.C) {
|
func (s *DockerSuite) TestBuildStopSignal(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
testRequires(c, DaemonIsLinux)
|
||||||
name := "test_build_stop_signal"
|
imgName := "test_build_stop_signal"
|
||||||
_, err := buildImage(name,
|
_, err := buildImage(imgName,
|
||||||
`FROM busybox
|
`FROM busybox
|
||||||
STOPSIGNAL SIGKILL`,
|
STOPSIGNAL SIGKILL`,
|
||||||
true)
|
true)
|
||||||
c.Assert(err, check.IsNil)
|
c.Assert(err, check.IsNil)
|
||||||
res := inspectFieldJSON(c, name, "Config.StopSignal")
|
res := inspectFieldJSON(c, imgName, "Config.StopSignal")
|
||||||
|
if res != `"SIGKILL"` {
|
||||||
|
c.Fatalf("Signal %s, expected SIGKILL", res)
|
||||||
|
}
|
||||||
|
|
||||||
|
containerName := "test-container-stop-signal"
|
||||||
|
dockerCmd(c, "run", "-d", "--name", containerName, imgName, "top")
|
||||||
|
|
||||||
|
res = inspectFieldJSON(c, containerName, "Config.StopSignal")
|
||||||
if res != `"SIGKILL"` {
|
if res != `"SIGKILL"` {
|
||||||
c.Fatalf("Signal %s, expected SIGKILL", res)
|
c.Fatalf("Signal %s, expected SIGKILL", res)
|
||||||
}
|
}
|
||||||
|
|
|
@ -375,7 +375,9 @@ func Parse(cmd *flag.FlagSet, args []string) (*container.Config, *container.Host
|
||||||
Entrypoint: entrypoint,
|
Entrypoint: entrypoint,
|
||||||
WorkingDir: *flWorkingDir,
|
WorkingDir: *flWorkingDir,
|
||||||
Labels: ConvertKVStringsToMap(labels),
|
Labels: ConvertKVStringsToMap(labels),
|
||||||
StopSignal: *flStopSignal,
|
}
|
||||||
|
if cmd.IsSet("-stop-signal") {
|
||||||
|
config.StopSignal = *flStopSignal
|
||||||
}
|
}
|
||||||
|
|
||||||
hostConfig := &container.HostConfig{
|
hostConfig := &container.HostConfig{
|
||||||
|
|
Loading…
Reference in a new issue