diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/create.go | 13 | ||||
-rw-r--r-- | cmd/podman/spec.go | 1 |
2 files changed, 12 insertions, 2 deletions
diff --git a/cmd/podman/create.go b/cmd/podman/create.go index 79f08220d..d3e14742b 100644 --- a/cmd/podman/create.go +++ b/cmd/podman/create.go @@ -7,8 +7,10 @@ import ( "os" "strconv" "strings" + "syscall" "github.com/docker/docker/api/types/container" + "github.com/docker/docker/pkg/signal" "github.com/docker/go-units" "github.com/opencontainers/selinux/go-selinux/label" "github.com/pkg/errors" @@ -107,7 +109,7 @@ type createConfig struct { Rm bool //rm ShmDir string SigProxy bool //sig-proxy - StopSignal string // stop-signal + StopSignal syscall.Signal // stop-signal StopTimeout int64 // stop-timeout StorageOpts []string //storage-opt Sysctl map[string]string //sysctl @@ -415,6 +417,13 @@ func parseCreateOpts(c *cli.Context, runtime *libpod.Runtime) (*createConfig, er } shmDir = ctr.ShmDir() } + stopSignal := syscall.SIGTERM + if c.IsSet("stop-signal") { + stopSignal, err = signal.ParseSignal(c.String("stop-signal")) + if err != nil { + return nil, err + } + } config := &createConfig{ Runtime: runtime, @@ -484,7 +493,7 @@ func parseCreateOpts(c *cli.Context, runtime *libpod.Runtime) (*createConfig, er Rm: c.Bool("rm"), ShmDir: shmDir, SigProxy: c.Bool("sig-proxy"), - StopSignal: c.String("stop-signal"), + StopSignal: stopSignal, StopTimeout: c.Int64("stop-timeout"), StorageOpts: c.StringSlice("storage-opt"), Sysctl: sysctl, diff --git a/cmd/podman/spec.go b/cmd/podman/spec.go index 550f74218..dc6e24c24 100644 --- a/cmd/podman/spec.go +++ b/cmd/podman/spec.go @@ -558,6 +558,7 @@ func (c *createConfig) GetContainerCreateOptions() ([]libpod.CtrCreateOption, er // TODO parse ports into libpod format and include // TODO should not happen if --net=host options = append(options, libpod.WithNetNS([]ocicni.PortMapping{})) + options = append(options, libpod.WithStopSignal(c.StopSignal)) return options, nil } |