summaryrefslogtreecommitdiff
path: root/cmd/podman/shared
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@pm.me>2019-04-01 15:22:32 -0400
committerMatthew Heon <matthew.heon@pm.me>2019-05-03 10:36:16 -0400
commit0d73ee40b2e95ec7d50c7ee72fcb24cae0e190a7 (patch)
tree665382c42613e99258536536d61b00462a67ae53 /cmd/podman/shared
parent3fb52f4fbb04781e32f72888c9e509dea5d7b434 (diff)
downloadpodman-0d73ee40b2e95ec7d50c7ee72fcb24cae0e190a7.tar.gz
podman-0d73ee40b2e95ec7d50c7ee72fcb24cae0e190a7.tar.bz2
podman-0d73ee40b2e95ec7d50c7ee72fcb24cae0e190a7.zip
Add container restart policy to Libpod & Podman
This initial version does not support restart count, but it works as advertised otherwise. Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'cmd/podman/shared')
-rw-r--r--cmd/podman/shared/create.go34
1 files changed, 16 insertions, 18 deletions
diff --git a/cmd/podman/shared/create.go b/cmd/podman/shared/create.go
index 81566326b..1ef852cd2 100644
--- a/cmd/podman/shared/create.go
+++ b/cmd/podman/shared/create.go
@@ -279,9 +279,6 @@ func ParseCreateOpts(ctx context.Context, c *GenericCLIResults, runtime *libpod.
blkioWeight uint16
namespaces map[string]string
)
- if c.IsSet("restart") {
- return nil, errors.Errorf("--restart option is not supported.\nUse systemd unit files for restarting containers")
- }
idmappings, err := util.ParseIDMapping(c.StringSlice("uidmap"), c.StringSlice("gidmap"), c.String("subuidname"), c.String("subgidname"))
if err != nil {
@@ -676,21 +673,22 @@ func ParseCreateOpts(ctx context.Context, c *GenericCLIResults, runtime *libpod.
PidsLimit: c.Int64("pids-limit"),
Ulimit: c.StringSlice("ulimit"),
},
- Rm: c.Bool("rm"),
- StopSignal: stopSignal,
- StopTimeout: c.Uint("stop-timeout"),
- Sysctl: sysctl,
- Systemd: systemd,
- Tmpfs: c.StringSlice("tmpfs"),
- Tty: tty,
- User: user,
- UsernsMode: usernsMode,
- MountsFlag: c.StringArray("mount"),
- Volumes: c.StringArray("volume"),
- WorkDir: workDir,
- Rootfs: rootfs,
- VolumesFrom: c.StringSlice("volumes-from"),
- Syslog: c.Bool("syslog"),
+ RestartPolicy: c.String("restart"),
+ Rm: c.Bool("rm"),
+ StopSignal: stopSignal,
+ StopTimeout: c.Uint("stop-timeout"),
+ Sysctl: sysctl,
+ Systemd: systemd,
+ Tmpfs: c.StringSlice("tmpfs"),
+ Tty: tty,
+ User: user,
+ UsernsMode: usernsMode,
+ MountsFlag: c.StringArray("mount"),
+ Volumes: c.StringArray("volume"),
+ WorkDir: workDir,
+ Rootfs: rootfs,
+ VolumesFrom: c.StringSlice("volumes-from"),
+ Syslog: c.Bool("syslog"),
}
if config.Privileged {