aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/podman/auto-update.go2
-rw-r--r--cmd/podman/common/create_opts.go291
-rw-r--r--cmd/podman/containers/attach.go2
-rw-r--r--cmd/podman/containers/checkpoint.go2
-rw-r--r--cmd/podman/containers/cleanup.go2
-rw-r--r--cmd/podman/containers/commit.go2
-rw-r--r--cmd/podman/containers/cp.go2
-rw-r--r--cmd/podman/containers/create.go2
-rw-r--r--cmd/podman/containers/diff.go2
-rw-r--r--cmd/podman/containers/exec.go2
-rw-r--r--cmd/podman/containers/exists.go2
-rw-r--r--cmd/podman/containers/export.go2
-rw-r--r--cmd/podman/containers/init.go2
-rw-r--r--cmd/podman/containers/inspect.go2
-rw-r--r--cmd/podman/containers/kill.go2
-rw-r--r--cmd/podman/containers/list.go2
-rw-r--r--cmd/podman/containers/logs.go2
-rw-r--r--cmd/podman/containers/mount.go2
-rw-r--r--cmd/podman/containers/pause.go2
-rw-r--r--cmd/podman/containers/port.go4
-rw-r--r--cmd/podman/containers/prune.go2
-rw-r--r--cmd/podman/containers/ps.go162
-rw-r--r--cmd/podman/containers/restart.go2
-rw-r--r--cmd/podman/containers/restore.go2
-rw-r--r--cmd/podman/containers/rm.go2
-rw-r--r--cmd/podman/containers/run.go2
-rw-r--r--cmd/podman/containers/runlabel.go2
-rw-r--r--cmd/podman/containers/start.go2
-rw-r--r--cmd/podman/containers/stats.go2
-rw-r--r--cmd/podman/containers/stop.go2
-rw-r--r--cmd/podman/containers/top.go2
-rw-r--r--cmd/podman/containers/unmount.go2
-rw-r--r--cmd/podman/containers/unpause.go2
-rw-r--r--cmd/podman/containers/wait.go16
-rw-r--r--cmd/podman/diff.go2
-rw-r--r--cmd/podman/generate/kube.go2
-rw-r--r--cmd/podman/generate/systemd.go2
-rw-r--r--cmd/podman/images/build.go6
-rw-r--r--cmd/podman/images/diff.go2
-rw-r--r--cmd/podman/images/history.go2
-rw-r--r--cmd/podman/images/import.go2
-rw-r--r--cmd/podman/images/inspect.go2
-rw-r--r--cmd/podman/images/list.go2
-rw-r--r--cmd/podman/images/load.go2
-rw-r--r--cmd/podman/images/mount.go2
-rw-r--r--cmd/podman/images/prune.go2
-rw-r--r--cmd/podman/images/pull.go2
-rw-r--r--cmd/podman/images/push.go2
-rw-r--r--cmd/podman/images/rm.go2
-rw-r--r--cmd/podman/images/save.go2
-rw-r--r--cmd/podman/images/search.go2
-rw-r--r--cmd/podman/images/sign.go2
-rw-r--r--cmd/podman/images/tree.go2
-rw-r--r--cmd/podman/images/trust_set.go2
-rw-r--r--cmd/podman/images/trust_show.go2
-rw-r--r--cmd/podman/images/unmount.go2
-rw-r--r--cmd/podman/inspect.go2
-rw-r--r--cmd/podman/login.go2
-rw-r--r--cmd/podman/logout.go2
-rw-r--r--cmd/podman/main.go1
-rw-r--r--cmd/podman/manifest/add.go2
-rw-r--r--cmd/podman/manifest/annotate.go2
-rw-r--r--cmd/podman/manifest/create.go2
-rw-r--r--cmd/podman/manifest/push.go2
-rw-r--r--cmd/podman/networks/create.go2
-rw-r--r--cmd/podman/networks/inspect.go2
-rw-r--r--cmd/podman/networks/list.go2
-rw-r--r--cmd/podman/networks/rm.go2
-rw-r--r--cmd/podman/play/kube.go2
-rw-r--r--cmd/podman/pods/create.go2
-rw-r--r--cmd/podman/pods/inspect.go2
-rw-r--r--cmd/podman/pods/kill.go2
-rw-r--r--cmd/podman/pods/pause.go2
-rw-r--r--cmd/podman/pods/prune.go2
-rw-r--r--cmd/podman/pods/ps.go2
-rw-r--r--cmd/podman/pods/restart.go2
-rw-r--r--cmd/podman/pods/rm.go2
-rw-r--r--cmd/podman/pods/start.go2
-rw-r--r--cmd/podman/pods/stats.go2
-rw-r--r--cmd/podman/pods/stop.go2
-rw-r--r--cmd/podman/pods/top.go2
-rw-r--r--cmd/podman/pods/unpause.go2
-rw-r--r--cmd/podman/root.go25
-rw-r--r--cmd/podman/system/connection/add.go2
-rw-r--r--cmd/podman/system/df.go2
-rw-r--r--cmd/podman/system/events.go2
-rw-r--r--cmd/podman/system/info.go2
-rw-r--r--cmd/podman/system/migrate.go2
-rw-r--r--cmd/podman/system/prune.go2
-rw-r--r--cmd/podman/system/reset.go2
-rw-r--r--cmd/podman/system/service.go2
-rw-r--r--cmd/podman/system/varlink.go2
-rw-r--r--cmd/podman/system/version.go2
-rw-r--r--cmd/podman/volumes/create.go2
-rw-r--r--cmd/podman/volumes/inspect.go2
-rw-r--r--cmd/podman/volumes/list.go2
-rw-r--r--cmd/podman/volumes/prune.go2
-rw-r--r--cmd/podman/volumes/rm.go2
-rw-r--r--completions/zsh/_podman56
-rwxr-xr-xdocs/remote-docs.sh2
-rw-r--r--docs/source/markdown/podman-pod-top.1.md2
-rw-r--r--docs/source/markdown/podman-wait.1.md7
-rw-r--r--go.mod2
-rw-r--r--go.sum4
-rwxr-xr-xhack/man-page-checker4
-rwxr-xr-xhack/xref-helpmsgs-manpages6
-rw-r--r--libpod/networking_linux.go14
-rw-r--r--pkg/api/handlers/compat/containers_create.go237
-rw-r--r--pkg/specgen/generate/oci.go2
-rw-r--r--test/apiv2/01-basic.at8
-rw-r--r--test/apiv2/20-containers.at10
-rwxr-xr-xtest/apiv2/test-apiv233
-rw-r--r--test/e2e/pod_create_test.go18
-rw-r--r--test/e2e/ps_test.go33
-rw-r--r--test/e2e/toolbox_test.go8
-rw-r--r--test/e2e/wait_test.go45
-rw-r--r--test/system/015-help.bats36
-rw-r--r--test/system/260-sdnotify.bats2
-rw-r--r--vendor/modules.txt2
119 files changed, 747 insertions, 471 deletions
diff --git a/cmd/podman/auto-update.go b/cmd/podman/auto-update.go
index 677266c83..1a3d4875f 100644
--- a/cmd/podman/auto-update.go
+++ b/cmd/podman/auto-update.go
@@ -20,7 +20,7 @@ var (
or similar units that create new containers in order to run the updated images.
Note that this command is experimental. Please refer to the podman-auto-update(1) man page for details.`
autoUpdateCommand = &cobra.Command{
- Use: "auto-update [flags]",
+ Use: "auto-update [options]",
Short: "Auto update containers according to their auto-update policy",
Long: autoUpdateDescription,
RunE: autoUpdate,
diff --git a/cmd/podman/common/create_opts.go b/cmd/podman/common/create_opts.go
index 83a25f4ab..f4fecf4b7 100644
--- a/cmd/podman/common/create_opts.go
+++ b/cmd/podman/common/create_opts.go
@@ -1,6 +1,15 @@
package common
-import "github.com/containers/podman/v2/pkg/domain/entities"
+import (
+ "fmt"
+ "net"
+ "strconv"
+ "strings"
+
+ "github.com/containers/podman/v2/pkg/api/handlers"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/specgen"
+)
type ContainerCLIOpts struct {
Annotation []string
@@ -111,3 +120,283 @@ type ContainerCLIOpts struct {
CgroupConf []string
}
+
+func stringMaptoArray(m map[string]string) []string {
+ a := make([]string, 0, len(m))
+ for k, v := range m {
+ a = append(a, fmt.Sprintf("%s=%s", k, v))
+ }
+ return a
+}
+
+// ContainerCreateToContainerCLIOpts converts a compat input struct to cliopts so it can be converted to
+// a specgen spec.
+func ContainerCreateToContainerCLIOpts(cc handlers.CreateContainerConfig) (*ContainerCLIOpts, []string, error) {
+ var (
+ capAdd []string
+ cappDrop []string
+ entrypoint string
+ init bool
+ specPorts []specgen.PortMapping
+ )
+
+ if cc.HostConfig.Init != nil {
+ init = *cc.HostConfig.Init
+ }
+
+ // Iterate devices and convert back to string
+ devices := make([]string, 0, len(cc.HostConfig.Devices))
+ for _, dev := range cc.HostConfig.Devices {
+ devices = append(devices, fmt.Sprintf("%s:%s:%s", dev.PathOnHost, dev.PathInContainer, dev.CgroupPermissions))
+ }
+
+ // iterate blkreaddevicebps
+ readBps := make([]string, 0, len(cc.HostConfig.BlkioDeviceReadBps))
+ for _, dev := range cc.HostConfig.BlkioDeviceReadBps {
+ readBps = append(readBps, dev.String())
+ }
+
+ // iterate blkreaddeviceiops
+ readIops := make([]string, 0, len(cc.HostConfig.BlkioDeviceReadIOps))
+ for _, dev := range cc.HostConfig.BlkioDeviceReadIOps {
+ readIops = append(readIops, dev.String())
+ }
+
+ // iterate blkwritedevicebps
+ writeBps := make([]string, 0, len(cc.HostConfig.BlkioDeviceWriteBps))
+ for _, dev := range cc.HostConfig.BlkioDeviceWriteBps {
+ writeBps = append(writeBps, dev.String())
+ }
+
+ // iterate blkwritedeviceiops
+ writeIops := make([]string, 0, len(cc.HostConfig.BlkioDeviceWriteIOps))
+ for _, dev := range cc.HostConfig.BlkioDeviceWriteIOps {
+ writeIops = append(writeIops, dev.String())
+ }
+
+ // entrypoint
+ // can be a string or slice. if it is a slice, we need to
+ // marshall it to json; otherwise it should just be the string
+ // value
+ if len(cc.Config.Entrypoint) > 0 {
+ entrypoint = cc.Config.Entrypoint[0]
+ if len(cc.Config.Entrypoint) > 1 {
+ b, err := json.Marshal(cc.Config.Entrypoint)
+ if err != nil {
+ return nil, nil, err
+ }
+ entrypoint = string(b)
+ }
+ }
+
+ // expose ports
+ expose := make([]string, 0, len(cc.Config.ExposedPorts))
+ for p := range cc.Config.ExposedPorts {
+ expose = append(expose, fmt.Sprintf("%s/%s", p.Port(), p.Proto()))
+ }
+
+ // mounts type=tmpfs/bind,source=,dest=,opt=val
+ // TODO options
+ mounts := make([]string, 0, len(cc.HostConfig.Mounts))
+ for _, m := range cc.HostConfig.Mounts {
+ mount := fmt.Sprintf("type=%s", m.Type)
+ if len(m.Source) > 0 {
+ mount += fmt.Sprintf("source=%s", m.Source)
+ }
+ if len(m.Target) > 0 {
+ mount += fmt.Sprintf("dest=%s", m.Target)
+ }
+ mounts = append(mounts, mount)
+ }
+
+ //volumes
+ volumes := make([]string, 0, len(cc.Config.Volumes))
+ for v := range cc.Config.Volumes {
+ volumes = append(volumes, v)
+ }
+
+ // dns
+ dns := make([]net.IP, 0, len(cc.HostConfig.DNS))
+ for _, d := range cc.HostConfig.DNS {
+ dns = append(dns, net.ParseIP(d))
+ }
+
+ // publish
+ for port, pbs := range cc.HostConfig.PortBindings {
+ for _, pb := range pbs {
+ hostport, err := strconv.Atoi(pb.HostPort)
+ if err != nil {
+ return nil, nil, err
+ }
+ tmpPort := specgen.PortMapping{
+ HostIP: pb.HostIP,
+ ContainerPort: uint16(port.Int()),
+ HostPort: uint16(hostport),
+ Range: 0,
+ Protocol: port.Proto(),
+ }
+ specPorts = append(specPorts, tmpPort)
+ }
+ }
+
+ // network names
+ endpointsConfig := cc.NetworkingConfig.EndpointsConfig
+ cniNetworks := make([]string, 0, len(endpointsConfig))
+ for netName := range endpointsConfig {
+ cniNetworks = append(cniNetworks, netName)
+ }
+
+ // netMode
+ nsmode, _, err := specgen.ParseNetworkNamespace(cc.HostConfig.NetworkMode.NetworkName())
+ if err != nil {
+ return nil, nil, err
+ }
+
+ netNS := specgen.Namespace{
+ NSMode: nsmode.NSMode,
+ Value: nsmode.Value,
+ }
+
+ // network
+ // Note: we cannot emulate compat exactly here. we only allow specifics of networks to be
+ // defined when there is only one network.
+ netInfo := entities.NetOptions{
+ AddHosts: cc.HostConfig.ExtraHosts,
+ CNINetworks: cniNetworks,
+ DNSOptions: cc.HostConfig.DNSOptions,
+ DNSSearch: cc.HostConfig.DNSSearch,
+ DNSServers: dns,
+ Network: netNS,
+ PublishPorts: specPorts,
+ }
+
+ // static IP and MAC
+ if len(endpointsConfig) == 1 {
+ for _, ep := range endpointsConfig {
+ // if IP address is provided
+ if len(ep.IPAddress) > 0 {
+ staticIP := net.ParseIP(ep.IPAddress)
+ netInfo.StaticIP = &staticIP
+ }
+ // If MAC address is provided
+ if len(ep.MacAddress) > 0 {
+ staticMac, err := net.ParseMAC(ep.MacAddress)
+ if err != nil {
+ return nil, nil, err
+ }
+ netInfo.StaticMAC = &staticMac
+ }
+ break
+ }
+ }
+
+ // Note: several options here are marked as "don't need". this is based
+ // on speculation by Matt and I. We think that these come into play later
+ // like with start. We believe this is just a difference in podman/compat
+ cliOpts := ContainerCLIOpts{
+ //Attach: nil, // dont need?
+ Authfile: "",
+ BlkIOWeight: strconv.Itoa(int(cc.HostConfig.BlkioWeight)),
+ BlkIOWeightDevice: nil, // TODO
+ CapAdd: append(capAdd, cc.HostConfig.CapAdd...),
+ CapDrop: append(cappDrop, cc.HostConfig.CapDrop...),
+ CGroupParent: cc.HostConfig.CgroupParent,
+ CIDFile: cc.HostConfig.ContainerIDFile,
+ CPUPeriod: uint64(cc.HostConfig.CPUPeriod),
+ CPUQuota: cc.HostConfig.CPUQuota,
+ CPURTPeriod: uint64(cc.HostConfig.CPURealtimePeriod),
+ CPURTRuntime: cc.HostConfig.CPURealtimeRuntime,
+ CPUShares: uint64(cc.HostConfig.CPUShares),
+ //CPUS: 0, // dont need?
+ CPUSetCPUs: cc.HostConfig.CpusetCpus,
+ CPUSetMems: cc.HostConfig.CpusetMems,
+ //Detach: false, // dont need
+ //DetachKeys: "", // dont need
+ Devices: devices,
+ DeviceCGroupRule: nil,
+ DeviceReadBPs: readBps,
+ DeviceReadIOPs: readIops,
+ DeviceWriteBPs: writeBps,
+ DeviceWriteIOPs: writeIops,
+ Entrypoint: &entrypoint,
+ Env: cc.Config.Env,
+ Expose: expose,
+ GroupAdd: cc.HostConfig.GroupAdd,
+ Hostname: cc.Config.Hostname,
+ ImageVolume: "bind",
+ Init: init,
+ Interactive: cc.Config.OpenStdin,
+ IPC: string(cc.HostConfig.IpcMode),
+ Label: stringMaptoArray(cc.Config.Labels),
+ LogDriver: cc.HostConfig.LogConfig.Type,
+ LogOptions: stringMaptoArray(cc.HostConfig.LogConfig.Config),
+ Memory: strconv.Itoa(int(cc.HostConfig.Memory)),
+ MemoryReservation: strconv.Itoa(int(cc.HostConfig.MemoryReservation)),
+ MemorySwap: strconv.Itoa(int(cc.HostConfig.MemorySwap)),
+ Name: cc.Name,
+ OOMScoreAdj: cc.HostConfig.OomScoreAdj,
+ OverrideArch: "",
+ OverrideOS: "",
+ OverrideVariant: "",
+ PID: string(cc.HostConfig.PidMode),
+ PIDsLimit: cc.HostConfig.PidsLimit,
+ Privileged: cc.HostConfig.Privileged,
+ PublishAll: cc.HostConfig.PublishAllPorts,
+ Quiet: false,
+ ReadOnly: cc.HostConfig.ReadonlyRootfs,
+ ReadOnlyTmpFS: true, // podman default
+ Rm: cc.HostConfig.AutoRemove,
+ SecurityOpt: cc.HostConfig.SecurityOpt,
+ ShmSize: strconv.Itoa(int(cc.HostConfig.ShmSize)),
+ StopSignal: cc.Config.StopSignal,
+ StoreageOpt: stringMaptoArray(cc.HostConfig.StorageOpt),
+ Sysctl: stringMaptoArray(cc.HostConfig.Sysctls),
+ Systemd: "true", // podman default
+ TmpFS: stringMaptoArray(cc.HostConfig.Tmpfs),
+ TTY: cc.Config.Tty,
+ //Ulimit: cc.HostConfig.Ulimits, // ask dan, no documented format
+ User: cc.Config.User,
+ UserNS: string(cc.HostConfig.UsernsMode),
+ UTS: string(cc.HostConfig.UTSMode),
+ Mount: mounts,
+ Volume: volumes,
+ VolumesFrom: cc.HostConfig.VolumesFrom,
+ Workdir: cc.Config.WorkingDir,
+ Net: &netInfo,
+ }
+
+ if cc.Config.StopTimeout != nil {
+ cliOpts.StopTimeout = uint(*cc.Config.StopTimeout)
+ }
+
+ if cc.HostConfig.KernelMemory > 0 {
+ cliOpts.KernelMemory = strconv.Itoa(int(cc.HostConfig.KernelMemory))
+ }
+ if len(cc.HostConfig.RestartPolicy.Name) > 0 {
+ policy := cc.HostConfig.RestartPolicy.Name
+ // only add restart count on failure
+ if cc.HostConfig.RestartPolicy.IsOnFailure() {
+ policy += fmt.Sprintf(":%d", cc.HostConfig.RestartPolicy.MaximumRetryCount)
+ }
+ cliOpts.Restart = policy
+ }
+
+ if cc.HostConfig.MemorySwappiness != nil {
+ cliOpts.MemorySwappiness = *cc.HostConfig.MemorySwappiness
+ }
+ if cc.HostConfig.OomKillDisable != nil {
+ cliOpts.OOMKillDisable = *cc.HostConfig.OomKillDisable
+ }
+ if cc.Config.Healthcheck != nil {
+ cliOpts.HealthCmd = strings.Join(cc.Config.Healthcheck.Test, " ")
+ cliOpts.HealthInterval = cc.Config.Healthcheck.Interval.String()
+ cliOpts.HealthRetries = uint(cc.Config.Healthcheck.Retries)
+ cliOpts.HealthStartPeriod = cc.Config.Healthcheck.StartPeriod.String()
+ cliOpts.HealthTimeout = cc.Config.Healthcheck.Timeout.String()
+ }
+
+ // specgen assumes the image name is arg[0]
+ cmd := []string{cc.Image}
+ cmd = append(cmd, cc.Config.Cmd...)
+ return &cliOpts, cmd, nil
+}
diff --git a/cmd/podman/containers/attach.go b/cmd/podman/containers/attach.go
index cfe7df441..0db7c22d0 100644
--- a/cmd/podman/containers/attach.go
+++ b/cmd/podman/containers/attach.go
@@ -14,7 +14,7 @@ import (
var (
attachDescription = "The podman attach command allows you to attach to a running container using the container's ID or name, either to view its ongoing output or to control it interactively."
attachCommand = &cobra.Command{
- Use: "attach [flags] CONTAINER",
+ Use: "attach [options] CONTAINER",
Short: "Attach to a running container",
Long: attachDescription,
RunE: attach,
diff --git a/cmd/podman/containers/checkpoint.go b/cmd/podman/containers/checkpoint.go
index 284393dc0..2606f62c5 100644
--- a/cmd/podman/containers/checkpoint.go
+++ b/cmd/podman/containers/checkpoint.go
@@ -20,7 +20,7 @@ var (
Checkpoints one or more running containers. The container name or ID can be used.
`
checkpointCommand = &cobra.Command{
- Use: "checkpoint [flags] CONTAINER [CONTAINER...]",
+ Use: "checkpoint [options] CONTAINER [CONTAINER...]",
Short: "Checkpoints one or more containers",
Long: checkpointDescription,
RunE: checkpoint,
diff --git a/cmd/podman/containers/cleanup.go b/cmd/podman/containers/cleanup.go
index 7913f5a10..54bc64a60 100644
--- a/cmd/podman/containers/cleanup.go
+++ b/cmd/podman/containers/cleanup.go
@@ -19,7 +19,7 @@ var (
Cleans up mount points and network stacks on one or more containers from the host. The container name or ID can be used. This command is used internally when running containers, but can also be used if container cleanup has failed when a container exits.
`
cleanupCommand = &cobra.Command{
- Use: "cleanup [flags] CONTAINER [CONTAINER...]",
+ Use: "cleanup [options] CONTAINER [CONTAINER...]",
Short: "Cleanup network and mountpoints of one or more containers",
Long: cleanupDescription,
RunE: cleanup,
diff --git a/cmd/podman/containers/commit.go b/cmd/podman/containers/commit.go
index 31294c66d..1b33d221d 100644
--- a/cmd/podman/containers/commit.go
+++ b/cmd/podman/containers/commit.go
@@ -18,7 +18,7 @@ var (
commitDescription = `Create an image from a container's changes. Optionally tag the image created, set the author with the --author flag, set the commit message with the --message flag, and make changes to the instructions with the --change flag.`
commitCommand = &cobra.Command{
- Use: "commit [flags] CONTAINER [IMAGE]",
+ Use: "commit [options] CONTAINER [IMAGE]",
Short: "Create new image based on the changed container",
Long: commitDescription,
RunE: commit,
diff --git a/cmd/podman/containers/cp.go b/cmd/podman/containers/cp.go
index 28a18e83e..5dfe43ded 100644
--- a/cmd/podman/containers/cp.go
+++ b/cmd/podman/containers/cp.go
@@ -16,7 +16,7 @@ var (
You can copy from the container's file system to the local machine or the reverse, from the local filesystem to the container. If "-" is specified for either the SRC_PATH or DEST_PATH, you can also stream a tar archive from STDIN or to STDOUT. The CONTAINER can be a running or stopped container. The SRC_PATH or DEST_PATH can be a file or directory.
`
cpCommand = &cobra.Command{
- Use: "cp [flags] SRC_PATH DEST_PATH",
+ Use: "cp [options] SRC_PATH DEST_PATH",
Short: "Copy files/folders between a container and the local filesystem",
Long: cpDescription,
Args: cobra.ExactArgs(2),
diff --git a/cmd/podman/containers/create.go b/cmd/podman/containers/create.go
index eb96e22b5..e3e1038f4 100644
--- a/cmd/podman/containers/create.go
+++ b/cmd/podman/containers/create.go
@@ -29,7 +29,7 @@ var (
The container ID is then printed to stdout. You can then start it at any time with the podman start <container_id> command. The container will be created with the initial state 'created'.`
createCommand = &cobra.Command{
- Use: "create [flags] IMAGE [COMMAND [ARG...]]",
+ Use: "create [options] IMAGE [COMMAND [ARG...]]",
Short: "Create but do not start a container",
Long: createDescription,
RunE: create,
diff --git a/cmd/podman/containers/diff.go b/cmd/podman/containers/diff.go
index a3ca6edf9..4ea7ff82e 100644
--- a/cmd/podman/containers/diff.go
+++ b/cmd/podman/containers/diff.go
@@ -13,7 +13,7 @@ import (
var (
// podman container _diff_
diffCmd = &cobra.Command{
- Use: "diff [flags] CONTAINER",
+ Use: "diff [options] CONTAINER",
Args: validate.IDOrLatestArgs,
Short: "Inspect changes to the container's file systems",
Long: `Displays changes to the container filesystem's'. The container will be compared to its parent layer.`,
diff --git a/cmd/podman/containers/exec.go b/cmd/podman/containers/exec.go
index e301ca588..88851f619 100644
--- a/cmd/podman/containers/exec.go
+++ b/cmd/podman/containers/exec.go
@@ -20,7 +20,7 @@ var (
execDescription = `Execute the specified command inside a running container.
`
execCommand = &cobra.Command{
- Use: "exec [flags] CONTAINER [COMMAND [ARG...]]",
+ Use: "exec [options] CONTAINER [COMMAND [ARG...]]",
Short: "Run a process in a running container",
Long: execDescription,
RunE: exec,
diff --git a/cmd/podman/containers/exists.go b/cmd/podman/containers/exists.go
index 1d79b684d..70b8af159 100644
--- a/cmd/podman/containers/exists.go
+++ b/cmd/podman/containers/exists.go
@@ -12,7 +12,7 @@ var (
containerExistsDescription = `If the named container exists in local storage, podman container exists exits with 0, otherwise the exit code will be 1.`
existsCommand = &cobra.Command{
- Use: "exists [flags] CONTAINER",
+ Use: "exists [options] CONTAINER",
Short: "Check if a container exists in local storage",
Long: containerExistsDescription,
Example: `podman container exists --external containerID
diff --git a/cmd/podman/containers/export.go b/cmd/podman/containers/export.go
index 1a59b7fff..f5e02d134 100644
--- a/cmd/podman/containers/export.go
+++ b/cmd/podman/containers/export.go
@@ -18,7 +18,7 @@ var (
" and saves it on the local machine."
exportCommand = &cobra.Command{
- Use: "export [flags] CONTAINER",
+ Use: "export [options] CONTAINER",
Short: "Export container's filesystem contents as a tar archive",
Long: exportDescription,
RunE: export,
diff --git a/cmd/podman/containers/init.go b/cmd/podman/containers/init.go
index 5a826bc59..983c0e4e8 100644
--- a/cmd/podman/containers/init.go
+++ b/cmd/podman/containers/init.go
@@ -15,7 +15,7 @@ var (
initDescription = `Initialize one or more containers, creating the OCI spec and mounts for inspection. Container names or IDs can be used.`
initCommand = &cobra.Command{
- Use: "init [flags] CONTAINER [CONTAINER...]",
+ Use: "init [options] CONTAINER [CONTAINER...]",
Short: "Initialize one or more containers",
Long: initDescription,
RunE: initContainer,
diff --git a/cmd/podman/containers/inspect.go b/cmd/podman/containers/inspect.go
index 1c208b513..b4e1feccb 100644
--- a/cmd/podman/containers/inspect.go
+++ b/cmd/podman/containers/inspect.go
@@ -11,7 +11,7 @@ import (
var (
// podman container _inspect_
inspectCmd = &cobra.Command{
- Use: "inspect [flags] CONTAINER [CONTAINER...]",
+ Use: "inspect [options] CONTAINER [CONTAINER...]",
Short: "Display the configuration of a container",
Long: `Displays the low-level information on a container identified by name or ID.`,
RunE: inspectExec,
diff --git a/cmd/podman/containers/kill.go b/cmd/podman/containers/kill.go
index a4d536098..1bb071b6d 100644
--- a/cmd/podman/containers/kill.go
+++ b/cmd/podman/containers/kill.go
@@ -17,7 +17,7 @@ import (
var (
killDescription = "The main process inside each container specified will be sent SIGKILL, or any signal specified with option --signal."
killCommand = &cobra.Command{
- Use: "kill [flags] CONTAINER [CONTAINER...]",
+ Use: "kill [options] CONTAINER [CONTAINER...]",
Short: "Kill one or more running containers with a specific signal",
Long: killDescription,
RunE: kill,
diff --git a/cmd/podman/containers/list.go b/cmd/podman/containers/list.go
index daf03a51b..78a15559f 100644
--- a/cmd/podman/containers/list.go
+++ b/cmd/podman/containers/list.go
@@ -10,7 +10,7 @@ import (
var (
// podman container _list_
listCmd = &cobra.Command{
- Use: "list",
+ Use: "list [options]",
Aliases: []string{"ls"},
Args: validate.NoArgs,
Short: "List containers",
diff --git a/cmd/podman/containers/logs.go b/cmd/podman/containers/logs.go
index acc2ab1aa..8ad2d7e16 100644
--- a/cmd/podman/containers/logs.go
+++ b/cmd/podman/containers/logs.go
@@ -27,7 +27,7 @@ var (
This does not guarantee execution order when combined with podman run (i.e., your run may not have generated any logs at the time you execute podman logs).
`
logsCommand = &cobra.Command{
- Use: "logs [flags] CONTAINER [CONTAINER...]",
+ Use: "logs [options] CONTAINER [CONTAINER...]",
Short: "Fetch the logs of one or more containers",
Long: logsDescription,
Args: func(cmd *cobra.Command, args []string) error {
diff --git a/cmd/podman/containers/mount.go b/cmd/podman/containers/mount.go
index c4dfb513f..adaf4bc91 100644
--- a/cmd/podman/containers/mount.go
+++ b/cmd/podman/containers/mount.go
@@ -25,7 +25,7 @@ var (
`
mountCommand = &cobra.Command{
- Use: "mount [flags] [CONTAINER...]",
+ Use: "mount [options] [CONTAINER...]",
Short: "Mount a working container's root filesystem",
Long: mountDescription,
RunE: mount,
diff --git a/cmd/podman/containers/pause.go b/cmd/podman/containers/pause.go
index c5171303d..89a76ab25 100644
--- a/cmd/podman/containers/pause.go
+++ b/cmd/podman/containers/pause.go
@@ -17,7 +17,7 @@ import (
var (
pauseDescription = `Pauses one or more running containers. The container name or ID can be used.`
pauseCommand = &cobra.Command{
- Use: "pause [flags] CONTAINER [CONTAINER...]",
+ Use: "pause [options] CONTAINER [CONTAINER...]",
Short: "Pause all the processes in one or more containers",
Long: pauseDescription,
RunE: pause,
diff --git a/cmd/podman/containers/port.go b/cmd/podman/containers/port.go
index 347f06bba..a895f24b1 100644
--- a/cmd/podman/containers/port.go
+++ b/cmd/podman/containers/port.go
@@ -18,7 +18,7 @@ var (
portDescription = `List port mappings for the CONTAINER, or lookup the public-facing port that is NAT-ed to the PRIVATE_PORT
`
portCommand = &cobra.Command{
- Use: "port [flags] CONTAINER [PORT]",
+ Use: "port [options] CONTAINER [PORT]",
Short: "List port mappings or a specific mapping for the container",
Long: portDescription,
RunE: port,
@@ -31,7 +31,7 @@ var (
}
containerPortCommand = &cobra.Command{
- Use: "port [flags] CONTAINER [PORT]",
+ Use: "port [options] CONTAINER [PORT]",
Short: portCommand.Short,
Long: portDescription,
RunE: portCommand.RunE,
diff --git a/cmd/podman/containers/prune.go b/cmd/podman/containers/prune.go
index cfe6765ac..bfdace086 100644
--- a/cmd/podman/containers/prune.go
+++ b/cmd/podman/containers/prune.go
@@ -21,7 +21,7 @@ var (
Removes all non running containers`)
pruneCommand = &cobra.Command{
- Use: "prune [flags]",
+ Use: "prune [options]",
Short: "Remove all non running containers",
Long: pruneDescription,
RunE: prune,
diff --git a/cmd/podman/containers/ps.go b/cmd/podman/containers/ps.go
index 41d309f51..80a50f4ef 100644
--- a/cmd/podman/containers/ps.go
+++ b/cmd/podman/containers/ps.go
@@ -27,7 +27,7 @@ import (
var (
psDescription = "Prints out information about the containers"
psCommand = &cobra.Command{
- Use: "ps",
+ Use: "ps [options]",
Args: validate.NoArgs,
Short: "List containers",
Long: psDescription,
@@ -371,12 +371,6 @@ func (l psReporter) CreatedHuman() string {
// portsToString converts the ports used to a string of the from "port1, port2"
// and also groups a continuous list of ports into a readable format.
func portsToString(ports []ocicni.PortMapping) string {
- type portGroup struct {
- first int32
- last int32
- }
- portDisplay := []string{}
-
if len(ports) == 0 {
return ""
}
@@ -385,41 +379,124 @@ func portsToString(ports []ocicni.PortMapping) string {
return comparePorts(ports[i], ports[j])
})
- // portGroupMap is used for grouping continuous ports.
- portGroupMap := make(map[string]*portGroup)
- var groupKeyList []string
+ portGroups := [][]ocicni.PortMapping{}
+ currentGroup := []ocicni.PortMapping{}
+ for i, v := range ports {
+ var prevPort, nextPort *int32
+ if i > 0 {
+ prevPort = &ports[i-1].ContainerPort
+ }
+ if i+1 < len(ports) {
+ nextPort = &ports[i+1].ContainerPort
+ }
- for _, v := range ports {
+ port := v.ContainerPort
- hostIP := v.HostIP
- if hostIP == "" {
- hostIP = "0.0.0.0"
+ // Helper functions
+ addToCurrentGroup := func(x ocicni.PortMapping) {
+ currentGroup = append(currentGroup, x)
}
- // If hostPort and containerPort are not same, consider as individual port.
- if v.ContainerPort != v.HostPort {
- portDisplay = append(portDisplay, fmt.Sprintf("%s:%d->%d/%s", hostIP, v.HostPort, v.ContainerPort, v.Protocol))
- continue
+
+ addToPortGroup := func(x ocicni.PortMapping) {
+ portGroups = append(portGroups, []ocicni.PortMapping{x})
+ }
+
+ finishCurrentGroup := func() {
+ portGroups = append(portGroups, currentGroup)
+ currentGroup = []ocicni.PortMapping{}
}
- portMapKey := fmt.Sprintf("%s/%s", hostIP, v.Protocol)
+ // Single entry slice
+ if prevPort == nil && nextPort == nil {
+ addToPortGroup(v)
+ }
+
+ // Start of the slice with len > 0
+ if prevPort == nil && nextPort != nil {
+ isGroup := *nextPort-1 == port
+
+ if isGroup {
+ // Start with a group
+ addToCurrentGroup(v)
+ } else {
+ // Start with single item
+ addToPortGroup(v)
+ }
- portgroup, ok := portGroupMap[portMapKey]
- if !ok {
- portGroupMap[portMapKey] = &portGroup{first: v.ContainerPort, last: v.ContainerPort}
- // This list is required to traverse portGroupMap.
- groupKeyList = append(groupKeyList, portMapKey)
continue
}
- if portgroup.last == (v.ContainerPort - 1) {
- portgroup.last = v.ContainerPort
+ // Middle of the slice with len > 0
+ if prevPort != nil && nextPort != nil {
+ currentIsGroup := *prevPort+1 == port
+ nextIsGroup := *nextPort-1 == port
+
+ if currentIsGroup {
+ // Maybe in the middle of a group
+ addToCurrentGroup(v)
+
+ if !nextIsGroup {
+ // End of a group
+ finishCurrentGroup()
+ }
+ } else if nextIsGroup {
+ // Start of a new group
+ addToCurrentGroup(v)
+ } else {
+ // No group at all
+ addToPortGroup(v)
+ }
+
continue
}
+
+ // End of the slice with len > 0
+ if prevPort != nil && nextPort == nil {
+ isGroup := *prevPort+1 == port
+
+ if isGroup {
+ // End group
+ addToCurrentGroup(v)
+ finishCurrentGroup()
+ } else {
+ // End single item
+ addToPortGroup(v)
+ }
+ }
}
- // For each portMapKey, format group list and append to output string.
- for _, portKey := range groupKeyList {
- group := portGroupMap[portKey]
- portDisplay = append(portDisplay, formatGroup(portKey, group.first, group.last))
+
+ portDisplay := []string{}
+ for _, group := range portGroups {
+ if len(group) == 0 {
+ // Usually should not happen, but better do not crash.
+ continue
+ }
+
+ first := group[0]
+
+ hostIP := first.HostIP
+ if hostIP == "" {
+ hostIP = "0.0.0.0"
+ }
+
+ // Single mappings
+ if len(group) == 1 {
+ portDisplay = append(portDisplay,
+ fmt.Sprintf(
+ "%s:%d->%d/%s",
+ hostIP, first.HostPort, first.ContainerPort, first.Protocol,
+ ),
+ )
+ continue
+ }
+
+ // Group mappings
+ last := group[len(group)-1]
+ portDisplay = append(portDisplay, formatGroup(
+ fmt.Sprintf("%s/%s", hostIP, first.Protocol),
+ first.HostPort, last.HostPort,
+ first.ContainerPort, last.ContainerPort,
+ ))
}
return strings.Join(portDisplay, ", ")
}
@@ -440,9 +517,10 @@ func comparePorts(i, j ocicni.PortMapping) bool {
return i.Protocol < j.Protocol
}
-// formatGroup returns the group as <IP:startPort:lastPort->startPort:lastPort/Proto>
-// e.g 0.0.0.0:1000-1006->1000-1006/tcp.
-func formatGroup(key string, start, last int32) string {
+// formatGroup returns the group in the format:
+// <IP:firstHost:lastHost->firstCtr:lastCtr/Proto>
+// e.g 0.0.0.0:1000-1006->2000-2006/tcp.
+func formatGroup(key string, firstHost, lastHost, firstCtr, lastCtr int32) string {
parts := strings.Split(key, "/")
groupType := parts[0]
var ip string
@@ -450,12 +528,16 @@ func formatGroup(key string, start, last int32) string {
ip = parts[0]
groupType = parts[1]
}
- group := strconv.Itoa(int(start))
- if start != last {
- group = fmt.Sprintf("%s-%d", group, last)
- }
- if ip != "" {
- group = fmt.Sprintf("%s:%s->%s", ip, group, group)
+
+ group := func(first, last int32) string {
+ group := strconv.Itoa(int(first))
+ if first != last {
+ group = fmt.Sprintf("%s-%d", group, last)
+ }
+ return group
}
- return fmt.Sprintf("%s/%s", group, groupType)
+ hostGroup := group(firstHost, lastHost)
+ ctrGroup := group(firstCtr, lastCtr)
+
+ return fmt.Sprintf("%s:%s->%s/%s", ip, hostGroup, ctrGroup, groupType)
}
diff --git a/cmd/podman/containers/restart.go b/cmd/podman/containers/restart.go
index 5f6f9c35c..1cc28c20d 100644
--- a/cmd/podman/containers/restart.go
+++ b/cmd/podman/containers/restart.go
@@ -20,7 +20,7 @@ var (
A timeout before forcibly stopping can be set, but defaults to %d seconds.`, containerConfig.Engine.StopTimeout)
restartCommand = &cobra.Command{
- Use: "restart [flags] CONTAINER [CONTAINER...]",
+ Use: "restart [options] CONTAINER [CONTAINER...]",
Short: "Restart one or more containers",
Long: restartDescription,
RunE: restart,
diff --git a/cmd/podman/containers/restore.go b/cmd/podman/containers/restore.go
index c996144e3..314bf7564 100644
--- a/cmd/podman/containers/restore.go
+++ b/cmd/podman/containers/restore.go
@@ -20,7 +20,7 @@ var (
Restores a container from a checkpoint. The container name or ID can be used.
`
restoreCommand = &cobra.Command{
- Use: "restore [flags] CONTAINER [CONTAINER...]",
+ Use: "restore [options] CONTAINER [CONTAINER...]",
Short: "Restores one or more containers from a checkpoint",
Long: restoreDescription,
RunE: restore,
diff --git a/cmd/podman/containers/rm.go b/cmd/podman/containers/rm.go
index a7739b3ba..ccdd2ef05 100644
--- a/cmd/podman/containers/rm.go
+++ b/cmd/podman/containers/rm.go
@@ -21,7 +21,7 @@ var (
Command does not remove images. Running or unusable containers will not be removed without the -f option.`
rmCommand = &cobra.Command{
- Use: "rm [flags] CONTAINER [CONTAINER...]",
+ Use: "rm [options] CONTAINER [CONTAINER...]",
Short: "Remove one or more containers",
Long: rmDescription,
RunE: rm,
diff --git a/cmd/podman/containers/run.go b/cmd/podman/containers/run.go
index cca0e8d1c..f8c248b04 100644
--- a/cmd/podman/containers/run.go
+++ b/cmd/podman/containers/run.go
@@ -25,7 +25,7 @@ var (
runDescription = "Runs a command in a new container from the given image"
runCommand = &cobra.Command{
Args: cobra.MinimumNArgs(1),
- Use: "run [flags] IMAGE [COMMAND [ARG...]]",
+ Use: "run [options] IMAGE [COMMAND [ARG...]]",
Short: "Run a command in a new container",
Long: runDescription,
RunE: run,
diff --git a/cmd/podman/containers/runlabel.go b/cmd/podman/containers/runlabel.go
index 5ee8c9d6c..b49af36ab 100644
--- a/cmd/podman/containers/runlabel.go
+++ b/cmd/podman/containers/runlabel.go
@@ -24,7 +24,7 @@ var (
runlabelOptions = runlabelOptionsWrapper{}
runlabelDescription = "Executes a command as described by a container image label."
runlabelCommand = &cobra.Command{
- Use: "runlabel [flags] LABEL IMAGE [ARG...]",
+ Use: "runlabel [options] LABEL IMAGE [ARG...]",
Short: "Execute the command described by an image label",
Long: runlabelDescription,
RunE: runlabel,
diff --git a/cmd/podman/containers/start.go b/cmd/podman/containers/start.go
index 1e58498b6..21f31d360 100644
--- a/cmd/podman/containers/start.go
+++ b/cmd/podman/containers/start.go
@@ -17,7 +17,7 @@ import (
var (
startDescription = `Starts one or more containers. The container name or ID can be used.`
startCommand = &cobra.Command{
- Use: "start [flags] CONTAINER [CONTAINER...]",
+ Use: "start [options] CONTAINER [CONTAINER...]",
Short: "Start one or more containers",
Long: startDescription,
RunE: start,
diff --git a/cmd/podman/containers/stats.go b/cmd/podman/containers/stats.go
index c30ea52ec..02afb1929 100644
--- a/cmd/podman/containers/stats.go
+++ b/cmd/podman/containers/stats.go
@@ -26,7 +26,7 @@ import (
var (
statsDescription = "Display percentage of CPU, memory, network I/O, block I/O and PIDs for one or more containers."
statsCommand = &cobra.Command{
- Use: "stats [flags] [CONTAINER...]",
+ Use: "stats [options] [CONTAINER...]",
Short: "Display a live stream of container resource usage statistics",
Long: statsDescription,
RunE: stats,
diff --git a/cmd/podman/containers/stop.go b/cmd/podman/containers/stop.go
index 1c0a5efe4..7c8c1b50e 100644
--- a/cmd/podman/containers/stop.go
+++ b/cmd/podman/containers/stop.go
@@ -17,7 +17,7 @@ var (
A timeout to forcibly stop the container can also be set but defaults to %d seconds otherwise.`, containerConfig.Engine.StopTimeout)
stopCommand = &cobra.Command{
- Use: "stop [flags] CONTAINER [CONTAINER...]",
+ Use: "stop [options] CONTAINER [CONTAINER...]",
Short: "Stop one or more containers",
Long: stopDescription,
RunE: stop,
diff --git a/cmd/podman/containers/top.go b/cmd/podman/containers/top.go
index f2632d57a..361d30516 100644
--- a/cmd/podman/containers/top.go
+++ b/cmd/podman/containers/top.go
@@ -26,7 +26,7 @@ var (
topOptions = entities.TopOptions{}
topCommand = &cobra.Command{
- Use: "top [flags] CONTAINER [FORMAT-DESCRIPTORS|ARGS...]",
+ Use: "top [options] CONTAINER [FORMAT-DESCRIPTORS|ARGS...]",
Short: "Display the running processes of a container",
Long: topDescription,
RunE: top,
diff --git a/cmd/podman/containers/unmount.go b/cmd/podman/containers/unmount.go
index 424d4cedc..c3159cfed 100644
--- a/cmd/podman/containers/unmount.go
+++ b/cmd/podman/containers/unmount.go
@@ -19,7 +19,7 @@ var (
An unmount can be forced with the --force flag.
`
unmountCommand = &cobra.Command{
- Use: "unmount [flags] CONTAINER [CONTAINER...]",
+ Use: "unmount [options] CONTAINER [CONTAINER...]",
Aliases: []string{"umount"},
Short: "Unmounts working container's root filesystem",
Long: description,
diff --git a/cmd/podman/containers/unpause.go b/cmd/podman/containers/unpause.go
index 43eaad72b..8927fc426 100644
--- a/cmd/podman/containers/unpause.go
+++ b/cmd/podman/containers/unpause.go
@@ -17,7 +17,7 @@ import (
var (
unpauseDescription = `Unpauses one or more previously paused containers. The container name or ID can be used.`
unpauseCommand = &cobra.Command{
- Use: "unpause [flags] CONTAINER [CONTAINER...]",
+ Use: "unpause [options] CONTAINER [CONTAINER...]",
Short: "Unpause the processes in one or more containers",
Long: unpauseDescription,
RunE: unpause,
diff --git a/cmd/podman/containers/wait.go b/cmd/podman/containers/wait.go
index 4bc3d20e2..b4986143b 100644
--- a/cmd/podman/containers/wait.go
+++ b/cmd/podman/containers/wait.go
@@ -19,11 +19,11 @@ var (
waitDescription = `Block until one or more containers stop and then print their exit codes.
`
waitCommand = &cobra.Command{
- Use: "wait [flags] CONTAINER [CONTAINER...]",
+ Use: "wait [options] CONTAINER [CONTAINER...]",
Short: "Block on one or more containers",
Long: waitDescription,
RunE: wait,
- Example: `podman wait --interval 5000 ctrID
+ Example: `podman wait --interval 5s ctrID
podman wait ctrID1 ctrID2`,
}
@@ -32,7 +32,7 @@ var (
Short: waitCommand.Short,
Long: waitCommand.Long,
RunE: waitCommand.RunE,
- Example: `podman container wait --interval 5000 ctrID
+ Example: `podman container wait --interval 5s ctrID
podman container wait ctrID1 ctrID2`,
}
)
@@ -40,10 +40,11 @@ var (
var (
waitOptions = entities.WaitOptions{}
waitCondition string
+ waitInterval string
)
func waitFlags(flags *pflag.FlagSet) {
- flags.DurationVarP(&waitOptions.Interval, "interval", "i", time.Duration(250), "Milliseconds to wait before polling for completion")
+ flags.StringVarP(&waitInterval, "interval", "i", "250ns", "Time Interval to wait before polling for completion")
flags.StringVar(&waitCondition, "condition", "stopped", "Condition to wait on")
}
@@ -70,8 +71,11 @@ func wait(cmd *cobra.Command, args []string) error {
err error
errs utils.OutputErrors
)
- if waitOptions.Interval == 0 {
- return errors.New("interval must be greater then 0")
+ if waitOptions.Interval, err = time.ParseDuration(waitInterval); err != nil {
+ var err1 error
+ if waitOptions.Interval, err1 = time.ParseDuration(waitInterval + "ms"); err1 != nil {
+ return err
+ }
}
if !waitOptions.Latest && len(args) == 0 {
diff --git a/cmd/podman/diff.go b/cmd/podman/diff.go
index 9d2236abe..bad31a4a2 100644
--- a/cmd/podman/diff.go
+++ b/cmd/podman/diff.go
@@ -17,7 +17,7 @@ var (
// Command: podman _diff_ Object_ID
diffDescription = `Displays changes on a container or image's filesystem. The container or image will be compared to its parent layer.`
diffCmd = &cobra.Command{
- Use: "diff [flags] {CONTAINER_ID | IMAGE_ID}",
+ Use: "diff [options] {CONTAINER_ID | IMAGE_ID}",
Args: validate.IDOrLatestArgs,
Short: "Display the changes to the object's file system",
Long: diffDescription,
diff --git a/cmd/podman/generate/kube.go b/cmd/podman/generate/kube.go
index 2f63ba590..4935fc60c 100644
--- a/cmd/podman/generate/kube.go
+++ b/cmd/podman/generate/kube.go
@@ -20,7 +20,7 @@ var (
Whether the input is for a container or pod, Podman will always generate the specification as a pod.`
kubeCmd = &cobra.Command{
- Use: "kube [flags] CONTAINER | POD",
+ Use: "kube [options] CONTAINER | POD",
Short: "Generate Kubernetes YAML from a container or pod.",
Long: kubeDescription,
RunE: kube,
diff --git a/cmd/podman/generate/systemd.go b/cmd/podman/generate/systemd.go
index 02e826549..903f61aee 100644
--- a/cmd/podman/generate/systemd.go
+++ b/cmd/podman/generate/systemd.go
@@ -24,7 +24,7 @@ var (
The generated units can later be controlled via systemctl(1).`
systemdCmd = &cobra.Command{
- Use: "systemd [flags] CTR|POD",
+ Use: "systemd [options] CTR|POD",
Short: "Generate systemd units.",
Long: systemdDescription,
RunE: systemd,
diff --git a/cmd/podman/images/build.go b/cmd/podman/images/build.go
index ac1b2c848..18c31313b 100644
--- a/cmd/podman/images/build.go
+++ b/cmd/podman/images/build.go
@@ -40,7 +40,7 @@ var (
// Command: podman _diff_ Object_ID
buildDescription = "Builds an OCI or Docker image using instructions from one or more Containerfiles and a specified build context directory."
buildCmd = &cobra.Command{
- Use: "build [flags] [CONTEXT]",
+ Use: "build [options] [CONTEXT]",
Short: "Build an image using instructions from Containerfiles",
Long: buildDescription,
Args: cobra.MaximumNArgs(1),
@@ -282,8 +282,7 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *buil
flags.Layers = false
}
- var stdin, stdout, stderr, reporter *os.File
- stdin = os.Stdin
+ var stdout, stderr, reporter *os.File
stdout = os.Stdout
stderr = os.Stderr
reporter = os.Stderr
@@ -422,7 +421,6 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *buil
ForceRmIntermediateCtrs: flags.ForceRm,
IDMappingOptions: idmappingOptions,
IIDFile: flags.Iidfile,
- In: stdin,
Isolation: isolation,
Labels: flags.Label,
Layers: flags.Layers,
diff --git a/cmd/podman/images/diff.go b/cmd/podman/images/diff.go
index 05a05fa04..ed572ffdb 100644
--- a/cmd/podman/images/diff.go
+++ b/cmd/podman/images/diff.go
@@ -13,7 +13,7 @@ import (
var (
// podman container _inspect_
diffCmd = &cobra.Command{
- Use: "diff [flags] IMAGE",
+ Use: "diff [options] IMAGE",
Args: cobra.ExactArgs(1),
Short: "Inspect changes to the image's file systems",
Long: `Displays changes to the image's filesystem. The image will be compared to its parent layer.`,
diff --git a/cmd/podman/images/history.go b/cmd/podman/images/history.go
index fa4b368c6..aac978137 100644
--- a/cmd/podman/images/history.go
+++ b/cmd/podman/images/history.go
@@ -27,7 +27,7 @@ var (
// podman _history_
historyCmd = &cobra.Command{
- Use: "history [flags] IMAGE",
+ Use: "history [options] IMAGE",
Short: "Show history of a specified image",
Long: long,
Args: cobra.ExactArgs(1),
diff --git a/cmd/podman/images/import.go b/cmd/podman/images/import.go
index 1c234e743..e3545da69 100644
--- a/cmd/podman/images/import.go
+++ b/cmd/podman/images/import.go
@@ -19,7 +19,7 @@ var (
Note remote tar balls can be specified, via web address.
Optionally tag the image. You can specify the instructions using the --change option.`
importCommand = &cobra.Command{
- Use: "import [flags] PATH [REFERENCE]",
+ Use: "import [options] PATH [REFERENCE]",
Short: "Import a tarball to create a filesystem image",
Long: importDescription,
RunE: importCon,
diff --git a/cmd/podman/images/inspect.go b/cmd/podman/images/inspect.go
index 065dfaed2..8f005553d 100644
--- a/cmd/podman/images/inspect.go
+++ b/cmd/podman/images/inspect.go
@@ -10,7 +10,7 @@ import (
var (
// Command: podman image _inspect_
inspectCmd = &cobra.Command{
- Use: "inspect [flags] IMAGE [IMAGE...]",
+ Use: "inspect [options] IMAGE [IMAGE...]",
Short: "Display the configuration of an image",
Long: `Displays the low-level information of an image identified by name or ID.`,
RunE: inspectExec,
diff --git a/cmd/podman/images/list.go b/cmd/podman/images/list.go
index 239da9d28..e8f1ca9b4 100644
--- a/cmd/podman/images/list.go
+++ b/cmd/podman/images/list.go
@@ -35,7 +35,7 @@ type listFlagType struct {
var (
// Command: podman image _list_
listCmd = &cobra.Command{
- Use: "list [flags] [IMAGE]",
+ Use: "list [options] [IMAGE]",
Aliases: []string{"ls"},
Args: cobra.MaximumNArgs(1),
Short: "List images in local storage",
diff --git a/cmd/podman/images/load.go b/cmd/podman/images/load.go
index cc8e71814..02f1b3b39 100644
--- a/cmd/podman/images/load.go
+++ b/cmd/podman/images/load.go
@@ -22,7 +22,7 @@ import (
var (
loadDescription = "Loads an image from a locally stored archive (tar file) into container storage."
loadCommand = &cobra.Command{
- Use: "load [flags] [NAME[:TAG]]",
+ Use: "load [options] [NAME[:TAG]]",
Short: "Load an image from container archive",
Long: loadDescription,
RunE: load,
diff --git a/cmd/podman/images/mount.go b/cmd/podman/images/mount.go
index 0a972ea81..db34d11d6 100644
--- a/cmd/podman/images/mount.go
+++ b/cmd/podman/images/mount.go
@@ -24,7 +24,7 @@ var (
`
mountCommand = &cobra.Command{
- Use: "mount [flags] [IMAGE...]",
+ Use: "mount [options] [IMAGE...]",
Short: "Mount an image's root filesystem",
Long: mountDescription,
RunE: mount,
diff --git a/cmd/podman/images/prune.go b/cmd/podman/images/prune.go
index 8dc203ead..b6e6b9562 100644
--- a/cmd/podman/images/prune.go
+++ b/cmd/podman/images/prune.go
@@ -19,7 +19,7 @@ var (
If an image is not being used by a container, it will be removed from the system.`
pruneCmd = &cobra.Command{
- Use: "prune",
+ Use: "prune [options]",
Args: validate.NoArgs,
Short: "Remove unused images",
Long: pruneDescription,
diff --git a/cmd/podman/images/pull.go b/cmd/podman/images/pull.go
index 595a2165e..35ef80f3c 100644
--- a/cmd/podman/images/pull.go
+++ b/cmd/podman/images/pull.go
@@ -30,7 +30,7 @@ var (
// Command: podman pull
pullCmd = &cobra.Command{
- Use: "pull [flags] IMAGE",
+ Use: "pull [options] IMAGE",
Args: cobra.ExactArgs(1),
Short: "Pull an image from a registry",
Long: pullDescription,
diff --git a/cmd/podman/images/push.go b/cmd/podman/images/push.go
index 24192eccd..718bd4e8c 100644
--- a/cmd/podman/images/push.go
+++ b/cmd/podman/images/push.go
@@ -29,7 +29,7 @@ var (
// Command: podman push
pushCmd = &cobra.Command{
- Use: "push [flags] SOURCE [DESTINATION]",
+ Use: "push [options] SOURCE [DESTINATION]",
Short: "Push an image to a specified destination",
Long: pushDescription,
RunE: imagePush,
diff --git a/cmd/podman/images/rm.go b/cmd/podman/images/rm.go
index f6e52a49e..9dddef48f 100644
--- a/cmd/podman/images/rm.go
+++ b/cmd/podman/images/rm.go
@@ -14,7 +14,7 @@ import (
var (
rmDescription = "Removes one or more previously pulled or locally created images."
rmCmd = &cobra.Command{
- Use: "rm [flags] IMAGE [IMAGE...]",
+ Use: "rm [options] IMAGE [IMAGE...]",
Short: "Removes one or more images from local storage",
Long: rmDescription,
RunE: rm,
diff --git a/cmd/podman/images/save.go b/cmd/podman/images/save.go
index b164a2534..db1fa7159 100644
--- a/cmd/podman/images/save.go
+++ b/cmd/podman/images/save.go
@@ -25,7 +25,7 @@ var (
saveDescription = `Save an image to docker-archive or oci-archive on the local machine. Default is docker-archive.`
saveCommand = &cobra.Command{
- Use: "save [flags] IMAGE [IMAGE...]",
+ Use: "save [options] IMAGE [IMAGE...]",
Short: "Save image(s) to an archive",
Long: saveDescription,
RunE: save,
diff --git a/cmd/podman/images/search.go b/cmd/podman/images/search.go
index 8edd776ce..a30dfe9c9 100644
--- a/cmd/podman/images/search.go
+++ b/cmd/podman/images/search.go
@@ -32,7 +32,7 @@ var (
// Command: podman search
searchCmd = &cobra.Command{
- Use: "search [flags] TERM",
+ Use: "search [options] TERM",
Short: "Search registry for image",
Long: searchDescription,
RunE: imageSearch,
diff --git a/cmd/podman/images/sign.go b/cmd/podman/images/sign.go
index e331a64df..f6c1f9856 100644
--- a/cmd/podman/images/sign.go
+++ b/cmd/podman/images/sign.go
@@ -12,7 +12,7 @@ import (
var (
signDescription = "Create a signature file that can be used later to verify the image."
signCommand = &cobra.Command{
- Use: "sign [flags] IMAGE [IMAGE...]",
+ Use: "sign [options] IMAGE [IMAGE...]",
Short: "Sign an image",
Long: signDescription,
RunE: sign,
diff --git a/cmd/podman/images/tree.go b/cmd/podman/images/tree.go
index 0b79c2a4b..237a2ab91 100644
--- a/cmd/podman/images/tree.go
+++ b/cmd/podman/images/tree.go
@@ -11,7 +11,7 @@ import (
var (
treeDescription = "Prints layer hierarchy of an image in a tree format"
treeCmd = &cobra.Command{
- Use: "tree [flags] IMAGE",
+ Use: "tree [options] IMAGE",
Args: cobra.ExactArgs(1),
Short: treeDescription,
Long: treeDescription,
diff --git a/cmd/podman/images/trust_set.go b/cmd/podman/images/trust_set.go
index 878ffeea6..2e4b4fe17 100644
--- a/cmd/podman/images/trust_set.go
+++ b/cmd/podman/images/trust_set.go
@@ -12,7 +12,7 @@ import (
var (
setTrustDescription = "Set default trust policy or add a new trust policy for a registry"
setTrustCommand = &cobra.Command{
- Use: "set [flags] REGISTRY",
+ Use: "set [options] REGISTRY",
Short: "Set default trust policy or a new trust policy for a registry",
Long: setTrustDescription,
Example: "",
diff --git a/cmd/podman/images/trust_show.go b/cmd/podman/images/trust_show.go
index d1f85d34d..ba3b4e7fb 100644
--- a/cmd/podman/images/trust_show.go
+++ b/cmd/podman/images/trust_show.go
@@ -14,7 +14,7 @@ import (
var (
showTrustDescription = "Display trust policy for the system"
showTrustCommand = &cobra.Command{
- Use: "show [flags] [REGISTRY]",
+ Use: "show [options] [REGISTRY]",
Short: "Display trust policy for the system",
Long: showTrustDescription,
RunE: showTrust,
diff --git a/cmd/podman/images/unmount.go b/cmd/podman/images/unmount.go
index f7f6cf8e5..50dc972e8 100644
--- a/cmd/podman/images/unmount.go
+++ b/cmd/podman/images/unmount.go
@@ -19,7 +19,7 @@ var (
An unmount can be forced with the --force flag.
`
unmountCommand = &cobra.Command{
- Use: "unmount [flags] IMAGE [IMAGE...]",
+ Use: "unmount [options] IMAGE [IMAGE...]",
Aliases: []string{"umount"},
Short: "Unmount an image's root filesystem",
Long: description,
diff --git a/cmd/podman/inspect.go b/cmd/podman/inspect.go
index 85050a497..f1d673a21 100644
--- a/cmd/podman/inspect.go
+++ b/cmd/podman/inspect.go
@@ -19,7 +19,7 @@ var (
// Command: podman _inspect_ Object_ID
inspectCmd = &cobra.Command{
- Use: "inspect [flags] {CONTAINER_ID | IMAGE_ID} [...]",
+ Use: "inspect [options] {CONTAINER_ID | IMAGE_ID} [...]",
Short: "Display the configuration of object denoted by ID",
RunE: inspectExec,
Long: inspectDescription,
diff --git a/cmd/podman/login.go b/cmd/podman/login.go
index 1556b0dcf..a789cef33 100644
--- a/cmd/podman/login.go
+++ b/cmd/podman/login.go
@@ -20,7 +20,7 @@ type loginOptionsWrapper struct {
var (
loginOptions = loginOptionsWrapper{}
loginCommand = &cobra.Command{
- Use: "login [flags] [REGISTRY]",
+ Use: "login [options] [REGISTRY]",
Short: "Login to a container registry",
Long: "Login to a container registry on a specified server.",
RunE: login,
diff --git a/cmd/podman/logout.go b/cmd/podman/logout.go
index 1c6fdfb2a..7b5615d30 100644
--- a/cmd/podman/logout.go
+++ b/cmd/podman/logout.go
@@ -14,7 +14,7 @@ import (
var (
logoutOptions = auth.LogoutOptions{}
logoutCommand = &cobra.Command{
- Use: "logout [flags] [REGISTRY]",
+ Use: "logout [options] [REGISTRY]",
Short: "Logout of a container registry",
Long: "Remove the cached username and password for the registry.",
RunE: logout,
diff --git a/cmd/podman/main.go b/cmd/podman/main.go
index 007a8716c..9747769c7 100644
--- a/cmd/podman/main.go
+++ b/cmd/podman/main.go
@@ -66,6 +66,7 @@ func main() {
// - rootCmd uses cobra default template not ours
c.Command.SetHelpTemplate(helpTemplate)
c.Command.SetUsageTemplate(usageTemplate)
+ c.Command.DisableFlagsInUseLine = true
}
}
}
diff --git a/cmd/podman/manifest/add.go b/cmd/podman/manifest/add.go
index 544d99c11..4b85f4c2a 100644
--- a/cmd/podman/manifest/add.go
+++ b/cmd/podman/manifest/add.go
@@ -25,7 +25,7 @@ type manifestAddOptsWrapper struct {
var (
manifestAddOpts = manifestAddOptsWrapper{}
addCmd = &cobra.Command{
- Use: "add [flags] LIST LIST",
+ Use: "add [options] LIST LIST",
Short: "Add images to a manifest list or image index",
Long: "Adds an image to a manifest list or image index.",
RunE: add,
diff --git a/cmd/podman/manifest/annotate.go b/cmd/podman/manifest/annotate.go
index 1b720aa39..861e94034 100644
--- a/cmd/podman/manifest/annotate.go
+++ b/cmd/podman/manifest/annotate.go
@@ -13,7 +13,7 @@ import (
var (
manifestAnnotateOpts = entities.ManifestAnnotateOptions{}
annotateCmd = &cobra.Command{
- Use: "annotate [flags] LIST IMAGE",
+ Use: "annotate [options] LIST IMAGE",
Short: "Add or update information about an entry in a manifest list or image index",
Long: "Adds or updates information about an entry in a manifest list or image index.",
RunE: annotate,
diff --git a/cmd/podman/manifest/create.go b/cmd/podman/manifest/create.go
index b5352d24f..956946f9d 100644
--- a/cmd/podman/manifest/create.go
+++ b/cmd/podman/manifest/create.go
@@ -13,7 +13,7 @@ import (
var (
manifestCreateOpts = entities.ManifestCreateOptions{}
createCmd = &cobra.Command{
- Use: "create [flags] LIST [IMAGE]",
+ Use: "create [options] LIST [IMAGE]",
Short: "Create manifest list or image index",
Long: "Creates manifest lists or image indexes.",
RunE: create,
diff --git a/cmd/podman/manifest/push.go b/cmd/podman/manifest/push.go
index fd3d51f37..91881c1b3 100644
--- a/cmd/podman/manifest/push.go
+++ b/cmd/podman/manifest/push.go
@@ -22,7 +22,7 @@ type manifestPushOptsWrapper struct {
var (
manifestPushOpts = manifestPushOptsWrapper{}
pushCmd = &cobra.Command{
- Use: "push [flags] SOURCE DESTINATION",
+ Use: "push [options] SOURCE DESTINATION",
Short: "Push a manifest list or image index to a registry",
Long: "Pushes manifest lists and image indexes to registries.",
RunE: push,
diff --git a/cmd/podman/networks/create.go b/cmd/podman/networks/create.go
index 17f39bd8b..634b01ced 100644
--- a/cmd/podman/networks/create.go
+++ b/cmd/podman/networks/create.go
@@ -14,7 +14,7 @@ import (
var (
networkCreateDescription = `create CNI networks for containers and pods`
networkCreateCommand = &cobra.Command{
- Use: "create [flags] [NETWORK]",
+ Use: "create [options] [NETWORK]",
Short: "network create",
Long: networkCreateDescription,
RunE: networkCreate,
diff --git a/cmd/podman/networks/inspect.go b/cmd/podman/networks/inspect.go
index c36125948..b5f141ac8 100644
--- a/cmd/podman/networks/inspect.go
+++ b/cmd/podman/networks/inspect.go
@@ -17,7 +17,7 @@ import (
var (
networkinspectDescription = `Inspect network`
networkinspectCommand = &cobra.Command{
- Use: "inspect [flags] NETWORK [NETWORK...]",
+ Use: "inspect [options] NETWORK [NETWORK...]",
Short: "network inspect",
Long: networkinspectDescription,
RunE: networkInspect,
diff --git a/cmd/podman/networks/list.go b/cmd/podman/networks/list.go
index c53f50c9f..25b7f292f 100644
--- a/cmd/podman/networks/list.go
+++ b/cmd/podman/networks/list.go
@@ -19,7 +19,7 @@ import (
var (
networklistDescription = `List networks`
networklistCommand = &cobra.Command{
- Use: "ls",
+ Use: "ls [options]",
Args: validate.NoArgs,
Short: "network list",
Long: networklistDescription,
diff --git a/cmd/podman/networks/rm.go b/cmd/podman/networks/rm.go
index 86aad43cb..3d7db941a 100644
--- a/cmd/podman/networks/rm.go
+++ b/cmd/podman/networks/rm.go
@@ -16,7 +16,7 @@ import (
var (
networkrmDescription = `Remove networks`
networkrmCommand = &cobra.Command{
- Use: "rm [flags] NETWORK [NETWORK...]",
+ Use: "rm [options] NETWORK [NETWORK...]",
Short: "network rm",
Long: networkrmDescription,
RunE: networkRm,
diff --git a/cmd/podman/play/kube.go b/cmd/podman/play/kube.go
index 1235f75a8..6072ea80c 100644
--- a/cmd/podman/play/kube.go
+++ b/cmd/podman/play/kube.go
@@ -32,7 +32,7 @@ var (
It creates the pod and containers described in the YAML. The containers within the pod are then started and the ID of the new Pod is output.`
kubeCmd = &cobra.Command{
- Use: "kube [flags] KUBEFILE",
+ Use: "kube [options] KUBEFILE",
Short: "Play a pod based on Kubernetes YAML.",
Long: kubeDescription,
RunE: kube,
diff --git a/cmd/podman/pods/create.go b/cmd/podman/pods/create.go
index ac6d83edd..efa84dcb4 100644
--- a/cmd/podman/pods/create.go
+++ b/cmd/podman/pods/create.go
@@ -27,7 +27,7 @@ var (
You can then start it at any time with the podman pod start <pod_id> command. The pod will be created with the initial state 'created'.`
createCommand = &cobra.Command{
- Use: "create",
+ Use: "create [options]",
Args: validate.NoArgs,
Short: "Create a new empty pod",
Long: podCreateDescription,
diff --git a/cmd/podman/pods/inspect.go b/cmd/podman/pods/inspect.go
index 142c8d270..659ebe1f0 100644
--- a/cmd/podman/pods/inspect.go
+++ b/cmd/podman/pods/inspect.go
@@ -26,7 +26,7 @@ var (
By default, this will render all results in a JSON array.`)
inspectCmd = &cobra.Command{
- Use: "inspect [flags] POD [POD...]",
+ Use: "inspect [options] POD [POD...]",
Short: "Displays a pod configuration",
Long: inspectDescription,
RunE: inspect,
diff --git a/cmd/podman/pods/kill.go b/cmd/podman/pods/kill.go
index d666d7537..1902a2c80 100644
--- a/cmd/podman/pods/kill.go
+++ b/cmd/podman/pods/kill.go
@@ -16,7 +16,7 @@ var (
The default signal is SIGKILL, or any signal specified with option --signal.`
killCommand = &cobra.Command{
- Use: "kill [flags] POD [POD...]",
+ Use: "kill [options] POD [POD...]",
Short: "Send the specified signal or SIGKILL to containers in pod",
Long: podKillDescription,
RunE: kill,
diff --git a/cmd/podman/pods/pause.go b/cmd/podman/pods/pause.go
index 591378983..bba26f90d 100644
--- a/cmd/podman/pods/pause.go
+++ b/cmd/podman/pods/pause.go
@@ -16,7 +16,7 @@ var (
All running containers within each specified pod will then be paused.`
pauseCommand = &cobra.Command{
- Use: "pause [flags] POD [POD...]",
+ Use: "pause [options] POD [POD...]",
Short: "Pause one or more pods",
Long: podPauseDescription,
RunE: pause,
diff --git a/cmd/podman/pods/prune.go b/cmd/podman/pods/prune.go
index f13d95ae9..e3eae3f71 100644
--- a/cmd/podman/pods/prune.go
+++ b/cmd/podman/pods/prune.go
@@ -23,7 +23,7 @@ var (
pruneDescription = fmt.Sprintf(`podman pod prune Removes all exited pods`)
pruneCommand = &cobra.Command{
- Use: "prune [flags]",
+ Use: "prune [options]",
Args: validate.NoArgs,
Short: "Remove all stopped pods and their containers",
Long: pruneDescription,
diff --git a/cmd/podman/pods/ps.go b/cmd/podman/pods/ps.go
index 0013cca02..aa9094428 100644
--- a/cmd/podman/pods/ps.go
+++ b/cmd/podman/pods/ps.go
@@ -25,7 +25,7 @@ var (
// Command: podman pod _ps_
psCmd = &cobra.Command{
- Use: "ps",
+ Use: "ps [options]",
Aliases: []string{"ls", "list"},
Short: "List pods",
Long: psDescription,
diff --git a/cmd/podman/pods/restart.go b/cmd/podman/pods/restart.go
index 11e8b4ebc..119b4ddee 100644
--- a/cmd/podman/pods/restart.go
+++ b/cmd/podman/pods/restart.go
@@ -16,7 +16,7 @@ var (
All of the containers within each of the specified pods will be restarted. If a container in a pod is not currently running it will be started.`
restartCommand = &cobra.Command{
- Use: "restart [flags] POD [POD...]",
+ Use: "restart [options] POD [POD...]",
Short: "Restart one or more pods",
Long: podRestartDescription,
RunE: restart,
diff --git a/cmd/podman/pods/rm.go b/cmd/podman/pods/rm.go
index 2975db3e8..714e075e2 100644
--- a/cmd/podman/pods/rm.go
+++ b/cmd/podman/pods/rm.go
@@ -28,7 +28,7 @@ var (
The pod name or ID can be used. A pod with containers will not be removed without --force. If --force is specified, all containers will be stopped, then removed.`)
rmCommand = &cobra.Command{
- Use: "rm [flags] POD [POD...]",
+ Use: "rm [options] POD [POD...]",
Short: "Remove one or more pods",
Long: podRmDescription,
RunE: rm,
diff --git a/cmd/podman/pods/start.go b/cmd/podman/pods/start.go
index e2ca3fd41..28ee4769a 100644
--- a/cmd/podman/pods/start.go
+++ b/cmd/podman/pods/start.go
@@ -24,7 +24,7 @@ var (
All containers defined in the pod will be started.`
startCommand = &cobra.Command{
- Use: "start [flags] POD [POD...]",
+ Use: "start [options] POD [POD...]",
Short: "Start one or more pods",
Long: podStartDescription,
RunE: start,
diff --git a/cmd/podman/pods/stats.go b/cmd/podman/pods/stats.go
index 2f59e4e47..38ecac97e 100644
--- a/cmd/podman/pods/stats.go
+++ b/cmd/podman/pods/stats.go
@@ -33,7 +33,7 @@ var (
statsDescription = `Display the containers' resource-usage statistics of one or more running pod`
// Command: podman pod _pod_
statsCmd = &cobra.Command{
- Use: "stats [flags] [POD...]",
+ Use: "stats [options] [POD...]",
Short: "Display a live stream of resource usage statistics for the containers in one or more pods",
Long: statsDescription,
RunE: stats,
diff --git a/cmd/podman/pods/stop.go b/cmd/podman/pods/stop.go
index 20c3f59bf..a2a9b0b57 100644
--- a/cmd/podman/pods/stop.go
+++ b/cmd/podman/pods/stop.go
@@ -29,7 +29,7 @@ var (
This command will stop all running containers in each of the specified pods.`
stopCommand = &cobra.Command{
- Use: "stop [flags] POD [POD...]",
+ Use: "stop [options] POD [POD...]",
Short: "Stop one or more pods",
Long: podStopDescription,
RunE: stop,
diff --git a/cmd/podman/pods/top.go b/cmd/podman/pods/top.go
index 9877db404..0ffa724da 100644
--- a/cmd/podman/pods/top.go
+++ b/cmd/podman/pods/top.go
@@ -23,7 +23,7 @@ var (
topOptions = entities.PodTopOptions{}
topCommand = &cobra.Command{
- Use: "top [flags] POD [FORMAT-DESCRIPTORS|ARGS...]",
+ Use: "top [options] POD [FORMAT-DESCRIPTORS|ARGS...]",
Short: "Display the running processes of containers in a pod",
Long: topDescription,
RunE: top,
diff --git a/cmd/podman/pods/unpause.go b/cmd/podman/pods/unpause.go
index 8474da57e..15b30db14 100644
--- a/cmd/podman/pods/unpause.go
+++ b/cmd/podman/pods/unpause.go
@@ -16,7 +16,7 @@ var (
The pod name or ID can be used.`
unpauseCommand = &cobra.Command{
- Use: "unpause [flags] POD [POD...]",
+ Use: "unpause [options] POD [POD...]",
Short: "Unpause one or more pods",
Long: podUnpauseDescription,
RunE: unpause,
diff --git a/cmd/podman/root.go b/cmd/podman/root.go
index 6293fa17d..b59b8341a 100644
--- a/cmd/podman/root.go
+++ b/cmd/podman/root.go
@@ -38,7 +38,7 @@ Description:
// command should not use this.
const usageTemplate = `Usage:{{if (and .Runnable (not .HasAvailableSubCommands))}}
{{.UseLine}}{{end}}{{if .HasAvailableSubCommands}}
- {{.CommandPath}} [command]{{end}}{{if gt (len .Aliases) 0}}
+ {{.UseLine}} [command]{{end}}{{if gt (len .Aliases) 0}}
Aliases:
{{.NameAndAliases}}{{end}}{{if .HasExample}}
@@ -49,24 +49,24 @@ Examples:
Available Commands:{{range .Commands}}{{if (or .IsAvailableCommand (eq .Name "help"))}}
{{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{if .HasAvailableLocalFlags}}
-Flags:
+Options:
{{.LocalFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasAvailableInheritedFlags}}
{{end}}
`
var (
rootCmd = &cobra.Command{
- Use: path.Base(os.Args[0]),
- Long: "Manage pods, containers and images",
- SilenceUsage: true,
- SilenceErrors: true,
- TraverseChildren: true,
- PersistentPreRunE: persistentPreRunE,
- RunE: validate.SubCommandExists,
- PersistentPostRunE: persistentPostRunE,
- Version: version.Version.String(),
+ Use: path.Base(os.Args[0]) + " [options]",
+ Long: "Manage pods, containers and images",
+ SilenceUsage: true,
+ SilenceErrors: true,
+ TraverseChildren: true,
+ PersistentPreRunE: persistentPreRunE,
+ RunE: validate.SubCommandExists,
+ PersistentPostRunE: persistentPostRunE,
+ Version: version.Version.String(),
+ DisableFlagsInUseLine: true,
}
-
logLevels = []string{"debug", "info", "warn", "error", "fatal", "panic"}
logLevel = "error"
useSyslog bool
@@ -81,6 +81,7 @@ func init() {
)
rootFlags(rootCmd, registry.PodmanConfig())
+ rootCmd.SetUsageTemplate(usageTemplate)
}
func Execute() {
diff --git a/cmd/podman/system/connection/add.go b/cmd/podman/system/connection/add.go
index df036af1a..0d81a64ca 100644
--- a/cmd/podman/system/connection/add.go
+++ b/cmd/podman/system/connection/add.go
@@ -27,7 +27,7 @@ const schemaPattern = "^[A-Za-z][A-Za-z0-9+.-]*:"
var (
addCmd = &cobra.Command{
- Use: "add [flags] NAME DESTINATION",
+ Use: "add [options] NAME DESTINATION",
Args: cobra.ExactArgs(2),
Short: "Record destination for the Podman service",
Long: `Add destination to podman configuration.
diff --git a/cmd/podman/system/df.go b/cmd/podman/system/df.go
index da7bbed02..63c80a8d9 100644
--- a/cmd/podman/system/df.go
+++ b/cmd/podman/system/df.go
@@ -23,7 +23,7 @@ var (
Show podman disk usage
`
dfSystemCommand = &cobra.Command{
- Use: "df",
+ Use: "df [options]",
Args: validate.NoArgs,
Short: "Show podman disk usage",
Long: dfSystemDescription,
diff --git a/cmd/podman/system/events.go b/cmd/podman/system/events.go
index aaf572873..3f3fbc340 100644
--- a/cmd/podman/system/events.go
+++ b/cmd/podman/system/events.go
@@ -20,7 +20,7 @@ var (
By default, streaming mode is used, printing new events as they occur. Previous events can be listed via --since and --until.`
eventsCommand = &cobra.Command{
- Use: "events",
+ Use: "events [options]",
Args: validate.NoArgs,
Short: "Show podman events",
Long: eventsDescription,
diff --git a/cmd/podman/system/info.go b/cmd/podman/system/info.go
index ee720abf8..b84bdc51a 100644
--- a/cmd/podman/system/info.go
+++ b/cmd/podman/system/info.go
@@ -20,7 +20,7 @@ var (
Useful for the user and when reporting issues.
`
infoCommand = &cobra.Command{
- Use: "info",
+ Use: "info [options]",
Args: validate.NoArgs,
Long: infoDescription,
Short: "Display podman system information",
diff --git a/cmd/podman/system/migrate.go b/cmd/podman/system/migrate.go
index 018701fc9..7870df60b 100644
--- a/cmd/podman/system/migrate.go
+++ b/cmd/podman/system/migrate.go
@@ -21,7 +21,7 @@ var (
`
migrateCommand = &cobra.Command{
- Use: "migrate",
+ Use: "migrate [options]",
Args: validate.NoArgs,
Short: "Migrate containers",
Long: migrateDescription,
diff --git a/cmd/podman/system/prune.go b/cmd/podman/system/prune.go
index f34df3698..a229b06b0 100644
--- a/cmd/podman/system/prune.go
+++ b/cmd/podman/system/prune.go
@@ -25,7 +25,7 @@ var (
`)
pruneCommand = &cobra.Command{
- Use: "prune [flags]",
+ Use: "prune [options]",
Short: "Remove unused data",
Args: validate.NoArgs,
Long: pruneDescription,
diff --git a/cmd/podman/system/reset.go b/cmd/podman/system/reset.go
index a7a42ea58..0b04c6ee0 100644
--- a/cmd/podman/system/reset.go
+++ b/cmd/podman/system/reset.go
@@ -22,7 +22,7 @@ var (
All containers will be stopped and removed, and all images, volumes and container content will be removed.
`
systemResetCommand = &cobra.Command{
- Use: "reset",
+ Use: "reset [options]",
Args: validate.NoArgs,
Short: "Reset podman storage",
Long: systemResetDescription,
diff --git a/cmd/podman/system/service.go b/cmd/podman/system/service.go
index 7c692b07e..2a2b1984f 100644
--- a/cmd/podman/system/service.go
+++ b/cmd/podman/system/service.go
@@ -26,7 +26,7 @@ Enable a listening service for API access to Podman commands.
`
srvCmd = &cobra.Command{
- Use: "service [flags] [URI]",
+ Use: "service [options] [URI]",
Args: cobra.MaximumNArgs(1),
Short: "Run API service",
Long: srvDescription,
diff --git a/cmd/podman/system/varlink.go b/cmd/podman/system/varlink.go
index 57e7e4ba6..89669d51a 100644
--- a/cmd/podman/system/varlink.go
+++ b/cmd/podman/system/varlink.go
@@ -16,7 +16,7 @@ var (
Tools speaking varlink protocol can remotely manage pods, containers and images.
`
varlinkCmd = &cobra.Command{
- Use: "varlink [flags] [URI]",
+ Use: "varlink [options] [URI]",
Args: cobra.MinimumNArgs(1),
Short: "Run varlink interface",
Long: varlinkDescription,
diff --git a/cmd/podman/system/version.go b/cmd/podman/system/version.go
index 4f47c5fba..5a5686744 100644
--- a/cmd/podman/system/version.go
+++ b/cmd/podman/system/version.go
@@ -19,7 +19,7 @@ import (
var (
versionCommand = &cobra.Command{
- Use: "version",
+ Use: "version [options]",
Args: validate.NoArgs,
Short: "Display the Podman Version Information",
RunE: version,
diff --git a/cmd/podman/volumes/create.go b/cmd/podman/volumes/create.go
index 934a552dc..a54530183 100644
--- a/cmd/podman/volumes/create.go
+++ b/cmd/podman/volumes/create.go
@@ -15,7 +15,7 @@ var (
createDescription = `If using the default driver, "local", the volume will be created on the host in the volumes directory under container storage.`
createCommand = &cobra.Command{
- Use: "create [flags] [NAME]",
+ Use: "create [options] [NAME]",
Short: "Create a new volume",
Long: createDescription,
RunE: create,
diff --git a/cmd/podman/volumes/inspect.go b/cmd/podman/volumes/inspect.go
index 8d1350228..674fd2b61 100644
--- a/cmd/podman/volumes/inspect.go
+++ b/cmd/podman/volumes/inspect.go
@@ -19,7 +19,7 @@ var (
Use a Go template to change the format from JSON.`
inspectCommand = &cobra.Command{
- Use: "inspect [flags] VOLUME [VOLUME...]",
+ Use: "inspect [options] VOLUME [VOLUME...]",
Short: "Display detailed information on one or more volumes",
Long: volumeInspectDescription,
RunE: inspect,
diff --git a/cmd/podman/volumes/list.go b/cmd/podman/volumes/list.go
index 18765a499..9a5fed0dd 100644
--- a/cmd/podman/volumes/list.go
+++ b/cmd/podman/volumes/list.go
@@ -24,7 +24,7 @@ podman volume ls
List all available volumes. The output of the volumes can be filtered
and the output format can be changed to JSON or a user specified Go template.`
lsCommand = &cobra.Command{
- Use: "ls",
+ Use: "ls [options]",
Aliases: []string{"list"},
Args: validate.NoArgs,
Short: "List volumes",
diff --git a/cmd/podman/volumes/prune.go b/cmd/podman/volumes/prune.go
index 78c258bec..79e6f1a54 100644
--- a/cmd/podman/volumes/prune.go
+++ b/cmd/podman/volumes/prune.go
@@ -21,7 +21,7 @@ var (
The command prompts for confirmation which can be overridden with the --force flag.
Note all data will be destroyed.`
pruneCommand = &cobra.Command{
- Use: "prune",
+ Use: "prune [options]",
Args: validate.NoArgs,
Short: "Remove all unused volumes",
Long: volumePruneDescription,
diff --git a/cmd/podman/volumes/rm.go b/cmd/podman/volumes/rm.go
index 4c960d4d5..4026764ac 100644
--- a/cmd/podman/volumes/rm.go
+++ b/cmd/podman/volumes/rm.go
@@ -18,7 +18,7 @@ var (
By default only volumes that are not being used by any containers will be removed. To remove the volumes anyways, use the --force flag.`
rmCommand = &cobra.Command{
- Use: "rm [flags] VOLUME [VOLUME...]",
+ Use: "rm [options] VOLUME [VOLUME...]",
Aliases: []string{"remove"},
Short: "Remove one or more volumes",
Long: volumeRmDescription,
diff --git a/completions/zsh/_podman b/completions/zsh/_podman
index 067eebbbb..b65c3dbb8 100644
--- a/completions/zsh/_podman
+++ b/completions/zsh/_podman
@@ -31,48 +31,48 @@ _read_podman_commands() {
eval "$_var_ref=(\$_podman_commands)"
}
-# Run 'podman XX --help', set _podman_flag_list to a formatted list
-# of flag options for XX
-_read_podman_flags() {
+# Run 'podman XX --help', set _podman_option_list to a formatted list
+# of option options for XX
+_read_podman_options() {
local line
- local _var_ref=_podman_flags_"${*// /_}"
+ local _var_ref=_podman_options_"${*// /_}"
eval "typeset -ga ${_var_ref}"
- typeset -ga _podman_flag_list
- _podman_flag_list=(${(P)_var_ref})
- (( $#_podman_flag_list )) && return
+ typeset -ga _podman_option_list
+ _podman_option_list=(${(P)_var_ref})
+ (( $#_podman_option_list )) && return
- # Extract the Flags; strip leading whitespace; pack '-f, --foo'
+ # Extract the Options; strip leading whitespace; pack '-f, --foo'
# as '-f,--foo' (no space); then add '=' to '--foo string'.
# The result will be, e.g. '-f,--foo=string Description of Option'
_call_program podman podman "$@" --help |\
- sed -n -e '0,/^Flags:/d' -e '/^$/q;p' |\
+ sed -n -e '0,/^Options:/d' -e '/^$/q;p' |\
grep '^ \+-' |\
sed -e 's/^ *//' -e 's/^\(-.,\) --/\1--/' |\
sed -e 's/^\(-[^ ]\+\) \([^ ]\+\) /\1=\2 /' |\
- while read flags desc;do
- # flags like --foo=string: split into --foo & string
+ while read options desc;do
+ # options like --foo=string: split into --foo & string
local -a tmpa
local optval=
- tmpa=(${(s.=.)flags})
+ tmpa=(${(s.=.)options})
if [ -n "$tmpa[2]" ]; then
- flags=$tmpa[1]
+ options=$tmpa[1]
optval=$tmpa[2]
fi
# 'podman attach --detach-keys' includes ']' in help msg
desc=${desc//\]/\\]}
- for flag in ${(s:,:)flags}; do
+ for option in ${(s:,:)options}; do
if [ -n "$optval" ]; then
- _podman_flag_list+=("${flag}[$desc]:$(_podman_find_helper ${flags} ${optval} ${desc})")
+ _podman_option_list+=("${option}[$desc]:$(_podman_find_helper ${options} ${optval} ${desc})")
else
- _podman_flag_list+=("${flag}[$desc]")
+ _podman_option_list+=("${option}[$desc]")
fi
done
done
- eval "typeset -ga $_var_ref=(\$_podman_flag_list)"
+ eval "typeset -ga $_var_ref=(\$_podman_option_list)"
}
# Run 'podman XXX --help', set _podman_usage to the line after "Usage:"
@@ -95,9 +95,9 @@ _read_podman_usage() {
###############################################################################
# BEGIN custom helpers for individual option arguments
-# Find a zsh helper for a given flag or command-line option
+# Find a zsh helper for a given option or command-line option
_podman_find_helper() {
- local flags=$1
+ local options=$1
local optval=$2
local desc=$3
local helper=
@@ -113,7 +113,7 @@ _podman_find_helper() {
helper=_files
# For messages like 'restart policy ("always"|"no"|"on-failure")
elif optlist=$(expr "$desc" : '.*(\(\"[^\\)]\+|[^\\)]\+\"\))' 2>/dev/null); then
- optval=${${flags##--}//-/ } # "--log-level" => "log level"
+ optval=${${options##--}//-/ } # "--log-level" => "log level"
optlist=${optlist//\"/} # "a"|"b"|"c" => a|b|c
optlist=${optlist//\|/ } # a|b|c => a b c
# FIXME: how to present values _in order_, not sorted alphabetically?
@@ -205,8 +205,8 @@ _set_up_podman_args() {
_read_podman_usage "$@"
typeset -ga _podman_args=()
- # E.g. 'podman exec [flags] CONTAINER [...' -> 'CONTAINER [....'
- local usage_rhs=$(expr "$_podman_usage" : ".*\[flags\] \+\(.*\)")
+ # E.g. 'podman exec [options] CONTAINER [...' -> 'CONTAINER [....'
+ local usage_rhs=$(expr "$_podman_usage" : ".*\[options\] \+\(.*\)")
# e.g. podman pod ps which takes no further args
if [ -z "$usage_rhs" ]; then
@@ -290,14 +290,14 @@ _set_up_podman_args() {
# For an endpoint command, i.e. not a subcommand.
_podman_terminus() {
typeset -A opt_args
- typeset -ga _podman_flag_list
+ typeset -ga _podman_option_list
typeset -ga _podman_args
integer ret=1
# Find out what args it takes (e.g. image(s), container(s)) and see
# if we have helpers for them.
_set_up_podman_args "$@"
- _arguments -C $_podman_flag_list $_podman_args && ret=0
+ _arguments -C $_podman_option_list $_podman_args && ret=0
return ret
}
@@ -319,7 +319,7 @@ _podman_terminus() {
# zsh first calls us with words=(podman container mount) but we don't
# want all that full context yet! We want to go a piece at a time,
# handling 'container' first, then 'mount'; ending up with our
-# final 'podman container mount --help' giving us suitable flags
+# final 'podman container mount --help' giving us suitable options
# and no subcommands; from which we determine that it's a terminus
# and jump to a function that handles non-subcommand arguments.
#
@@ -333,15 +333,15 @@ _podman_subcommand() {
# Run 'podman --help' / 'podman system --help' for our context (initially
# empty, then possibly under subcommands); from those, get a list of
- # flags appropriate for this context and, if applicable, subcommands.
- _read_podman_flags "$@"
+ # options appropriate for this context and, if applicable, subcommands.
+ _read_podman_options "$@"
_read_podman_commands "$@"
# Now, is this a sub-subcommand, or does it have args?
if (( $#_podman_commands )); then
# Subcommands required (podman, podman system, etc)
local cmd=${words// /_}
- _arguments -C $_podman_flag_list \
+ _arguments -C $_podman_option_list \
"(-): :->command" \
"(-)*:: :->option-or-argument" \
&& ret=0
diff --git a/docs/remote-docs.sh b/docs/remote-docs.sh
index a9fda4696..67c731e75 100755
--- a/docs/remote-docs.sh
+++ b/docs/remote-docs.sh
@@ -78,7 +78,7 @@ function html_fn() {
# the command name but not its description.
function podman_commands() {
$PODMAN help "$@" |\
- awk '/^Available Commands:/{ok=1;next}/^Flags:/{ok=0}ok { print $1 }' |\
+ awk '/^Available Commands:/{ok=1;next}/^Options:/{ok=0}ok { print $1 }' |\
grep .
}
diff --git a/docs/source/markdown/podman-pod-top.1.md b/docs/source/markdown/podman-pod-top.1.md
index 6a1fa8c42..1f2ffd662 100644
--- a/docs/source/markdown/podman-pod-top.1.md
+++ b/docs/source/markdown/podman-pod-top.1.md
@@ -7,7 +7,7 @@ podman\-pod\-top - Display the running processes of containers in a pod
**podman pod top** [*options*] *pod* [*format-descriptors*]
## DESCRIPTION
-Display the running processes of containers in a pod. The *format-descriptors* are ps (1) compatible AIX format descriptors but extended to print additional information, such as the seccomp mode or the effective capabilities of a given process. The descriptors can either be passed as separated arguments or as a single comma-separated argument. Note that you can also specify options and or flags of ps(1); in this case, Podman will fallback to executing ps with the specified arguments and flags in the container.
+Display the running processes of containers in a pod. The *format-descriptors* are ps (1) compatible AIX format descriptors but extended to print additional information, such as the seccomp mode or the effective capabilities of a given process. The descriptors can either be passed as separated arguments or as a single comma-separated argument. Note that you can specify options and/or additionally options of ps(1); in this case, Podman will fallback to executing ps with the specified arguments and options in the container.
## OPTIONS
diff --git a/docs/source/markdown/podman-wait.1.md b/docs/source/markdown/podman-wait.1.md
index 1d85e9af0..f0ccb1f9e 100644
--- a/docs/source/markdown/podman-wait.1.md
+++ b/docs/source/markdown/podman-wait.1.md
@@ -23,8 +23,8 @@ Condition to wait on (default "stopped")
Print usage statement
-**--interval**, **-i**=*microseconds*
- Microseconds to wait before polling for completion
+**--interval**, **-i**=*duration*
+ Time interval to wait before polling for completion. A duration string is a sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". Time unit defaults to "ms".
**--latest**, **-l**
@@ -42,6 +42,9 @@ $ podman wait mywebserver
$ podman wait --latest
0
+$ podman wait --interval 2s
+0
+
$ podman wait 860a4b23
1
diff --git a/go.mod b/go.mod
index 29a53de13..41ea2f62e 100644
--- a/go.mod
+++ b/go.mod
@@ -72,6 +72,6 @@ require (
gopkg.in/square/go-jose.v2 v2.5.1 // indirect
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 // indirect
k8s.io/api v0.0.0-20190620084959-7cf5895f2711
- k8s.io/apimachinery v0.19.2
+ k8s.io/apimachinery v0.19.3
k8s.io/client-go v0.0.0-20190620085101-78d2af792bab
)
diff --git a/go.sum b/go.sum
index 76a27d3d2..7f5e45543 100644
--- a/go.sum
+++ b/go.sum
@@ -815,8 +815,8 @@ honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt
k8s.io/api v0.0.0-20190620084959-7cf5895f2711 h1:BblVYz/wE5WtBsD/Gvu54KyBUTJMflolzc5I2DTvh50=
k8s.io/api v0.0.0-20190620084959-7cf5895f2711/go.mod h1:TBhBqb1AWbBQbW3XRusr7n7E4v2+5ZY8r8sAMnyFC5A=
k8s.io/apimachinery v0.0.0-20190612205821-1799e75a0719/go.mod h1:I4A+glKBHiTgiEjQiCCQfCAIcIMFGt291SmsvcrFzJA=
-k8s.io/apimachinery v0.19.2 h1:5Gy9vQpAGTKHPVOh5c4plE274X8D/6cuEiTO2zve7tc=
-k8s.io/apimachinery v0.19.2/go.mod h1:DnPGDnARWFvYa3pMHgSxtbZb7gpzzAZ1pTfaUNDVlmA=
+k8s.io/apimachinery v0.19.3 h1:bpIQXlKjB4cB/oNpnNnV+BybGPR7iP5oYpsOTEJ4hgc=
+k8s.io/apimachinery v0.19.3/go.mod h1:DnPGDnARWFvYa3pMHgSxtbZb7gpzzAZ1pTfaUNDVlmA=
k8s.io/client-go v0.0.0-20190620085101-78d2af792bab h1:E8Fecph0qbNsAbijJJQryKu4Oi9QTp5cVpjTE+nqg6g=
k8s.io/client-go v0.0.0-20190620085101-78d2af792bab/go.mod h1:E95RaSlHr79aHaX0aGSwcPNfygDiPKOVXdmivCIZT0k=
k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
diff --git a/hack/man-page-checker b/hack/man-page-checker
index 45f9edbd1..8ee0aaf6d 100755
--- a/hack/man-page-checker
+++ b/hack/man-page-checker
@@ -92,10 +92,10 @@ function compare_usage() {
# man page lists 'foo [*options*]', help msg shows 'foo [flags]'.
# Make sure if one has it, the other does too.
if expr "$from_man" : "\[\*options\*\]" >/dev/null; then
- if expr "$from_help" : "\[flags\]" >/dev/null; then
+ if expr "$from_help" : "\[options\]" >/dev/null; then
:
else
- echo "WARNING: $cmd: man page shows '[*options*]', help does not show [flags]"
+ echo "WARNING: $cmd: man page shows '[*options*]', help does not show [options]"
rc=1
fi
elif expr "$from_help" : "\[flags\]" >/dev/null; then
diff --git a/hack/xref-helpmsgs-manpages b/hack/xref-helpmsgs-manpages
index 7b617eed7..a7063259f 100755
--- a/hack/xref-helpmsgs-manpages
+++ b/hack/xref-helpmsgs-manpages
@@ -228,14 +228,14 @@ sub podman_help {
# Usage: ...
# Available Commands:
# ....
- # Flags:
+ # Options:
# ....
#
# Start by identifying the section we're in...
if ($line =~ /^Available\s+(Commands):/) {
$section = lc $1;
}
- elsif ($line =~ /^(Flags):/) {
+ elsif ($line =~ /^(Options):/) {
$section = lc $1;
}
@@ -320,7 +320,7 @@ sub podman_man {
}
}
- # Flags should always be of the form '**-f**' or '**--flag**',
+ # Options should always be of the form '**-f**' or '**--flag**',
# possibly separated by comma-space.
elsif ($section eq 'flags') {
# e.g. 'podman run --ip6', documented in man page, but nonexistent
diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go
index f87c311ce..df0ff6c32 100644
--- a/libpod/networking_linux.go
+++ b/libpod/networking_linux.go
@@ -823,6 +823,20 @@ func getContainerNetIO(ctr *Container) (*netlink.LinkStatistics, error) {
// Produce an InspectNetworkSettings containing information on the container
// network.
func (c *Container) getContainerNetworkInfo() (*define.InspectNetworkSettings, error) {
+ if c.config.NetNsCtr != "" {
+ netNsCtr, err := c.runtime.GetContainer(c.config.NetNsCtr)
+ if err != nil {
+ return nil, err
+ }
+ // Have to sync to ensure that state is populated
+ if err := netNsCtr.syncContainer(); err != nil {
+ return nil, err
+ }
+ logrus.Debugf("Container %s shares network namespace, retrieving network info of container %s", c.ID(), c.config.NetNsCtr)
+
+ return netNsCtr.getContainerNetworkInfo()
+ }
+
settings := new(define.InspectNetworkSettings)
settings.Ports = makeInspectPortBindings(c.config.PortMappings)
diff --git a/pkg/api/handlers/compat/containers_create.go b/pkg/api/handlers/compat/containers_create.go
index 8a0b3c922..87c95a24c 100644
--- a/pkg/api/handlers/compat/containers_create.go
+++ b/pkg/api/handlers/compat/containers_create.go
@@ -1,27 +1,19 @@
package compat
import (
- "context"
"encoding/json"
- "fmt"
"net/http"
- "strings"
- "github.com/containers/common/pkg/config"
+ "github.com/containers/podman/v2/cmd/podman/common"
"github.com/containers/podman/v2/libpod"
"github.com/containers/podman/v2/libpod/define"
- image2 "github.com/containers/podman/v2/libpod/image"
"github.com/containers/podman/v2/pkg/api/handlers"
"github.com/containers/podman/v2/pkg/api/handlers/utils"
- "github.com/containers/podman/v2/pkg/namespaces"
- "github.com/containers/podman/v2/pkg/rootless"
- "github.com/containers/podman/v2/pkg/signal"
- createconfig "github.com/containers/podman/v2/pkg/spec"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/domain/infra/abi"
"github.com/containers/podman/v2/pkg/specgen"
- "github.com/containers/storage"
"github.com/gorilla/schema"
"github.com/pkg/errors"
- "golang.org/x/sys/unix"
)
func CreateContainer(w http.ResponseWriter, r *http.Request) {
@@ -56,220 +48,27 @@ func CreateContainer(w http.ResponseWriter, r *http.Request) {
utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrap(err, "NewFromLocal()"))
return
}
- containerConfig, err := runtime.GetConfig()
+
+ // Take input structure and convert to cliopts
+ cliOpts, args, err := common.ContainerCreateToContainerCLIOpts(input)
if err != nil {
- utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrap(err, "GetConfig()"))
+ utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrap(err, "make cli opts()"))
return
}
- cc, err := makeCreateConfig(r.Context(), containerConfig, input, newImage)
- if err != nil {
- utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrap(err, "makeCreatConfig()"))
+ sg := specgen.NewSpecGenerator(newImage.ID(), cliOpts.RootFS)
+ if err := common.FillOutSpecGen(sg, cliOpts, args); err != nil {
+ utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrap(err, "fill out specgen"))
return
}
- cc.Name = query.Name
- utils.CreateContainer(r.Context(), w, runtime, &cc)
-}
-
-func makeCreateConfig(ctx context.Context, containerConfig *config.Config, input handlers.CreateContainerConfig, newImage *image2.Image) (createconfig.CreateConfig, error) {
- var (
- err error
- init bool
- )
- env := make(map[string]string)
- stopSignal := unix.SIGTERM
- if len(input.StopSignal) > 0 {
- stopSignal, err = signal.ParseSignal(input.StopSignal)
- if err != nil {
- return createconfig.CreateConfig{}, err
- }
- }
-
- workDir, err := newImage.WorkingDir(ctx)
+ ic := abi.ContainerEngine{Libpod: runtime}
+ report, err := ic.ContainerCreate(r.Context(), sg)
if err != nil {
- return createconfig.CreateConfig{}, err
- }
- if workDir == "" {
- workDir = "/"
- }
- if len(input.WorkingDir) > 0 {
- workDir = input.WorkingDir
- }
-
- // Only use image's Cmd when the user does not set the entrypoint
- if input.Entrypoint == nil && len(input.Cmd) == 0 {
- cmdSlice, err := newImage.Cmd(ctx)
- if err != nil {
- return createconfig.CreateConfig{}, err
- }
- input.Cmd = cmdSlice
- }
-
- if input.Entrypoint == nil {
- entrypointSlice, err := newImage.Entrypoint(ctx)
- if err != nil {
- return createconfig.CreateConfig{}, err
- }
- input.Entrypoint = entrypointSlice
- }
-
- stopTimeout := containerConfig.Engine.StopTimeout
- if input.StopTimeout != nil {
- stopTimeout = uint(*input.StopTimeout)
- }
- c := createconfig.CgroupConfig{
- Cgroups: "", // podman
- Cgroupns: "", // podman
- CgroupParent: "", // podman
- CgroupMode: "", // podman
- }
- security := createconfig.SecurityConfig{
- CapAdd: input.HostConfig.CapAdd,
- CapDrop: input.HostConfig.CapDrop,
- LabelOpts: nil, // podman
- NoNewPrivs: false, // podman
- ApparmorProfile: "", // podman
- SeccompProfilePath: "",
- SecurityOpts: input.HostConfig.SecurityOpt,
- Privileged: input.HostConfig.Privileged,
- ReadOnlyRootfs: input.HostConfig.ReadonlyRootfs,
- ReadOnlyTmpfs: false, // podman-only
- Sysctl: input.HostConfig.Sysctls,
- }
-
- var netmode namespaces.NetworkMode
- if rootless.IsRootless() {
- netmode = namespaces.NetworkMode(specgen.Slirp)
- }
-
- network := createconfig.NetworkConfig{
- DNSOpt: input.HostConfig.DNSOptions,
- DNSSearch: input.HostConfig.DNSSearch,
- DNSServers: input.HostConfig.DNS,
- ExposedPorts: input.ExposedPorts,
- HTTPProxy: false, // podman
- IP6Address: "",
- IPAddress: "",
- LinkLocalIP: nil, // docker-only
- MacAddress: input.MacAddress,
- NetMode: netmode,
- Network: input.HostConfig.NetworkMode.NetworkName(),
- NetworkAlias: nil, // docker-only now
- PortBindings: input.HostConfig.PortBindings,
- Publish: nil, // podmanseccompPath
- PublishAll: input.HostConfig.PublishAllPorts,
- }
-
- uts := createconfig.UtsConfig{
- UtsMode: namespaces.UTSMode(input.HostConfig.UTSMode),
- NoHosts: false, //podman
- HostAdd: input.HostConfig.ExtraHosts,
- Hostname: input.Hostname,
- }
-
- z := createconfig.UserConfig{
- GroupAdd: input.HostConfig.GroupAdd,
- IDMappings: &storage.IDMappingOptions{}, // podman //TODO <--- fix this,
- UsernsMode: namespaces.UsernsMode(input.HostConfig.UsernsMode),
- User: input.User,
- }
- pidConfig := createconfig.PidConfig{PidMode: namespaces.PidMode(input.HostConfig.PidMode)}
- // TODO: We should check that these binds are all listed in the `Volumes`
- // key since it doesn't make sense to define a `Binds` element for a
- // container path which isn't defined as a volume
- volumes := input.HostConfig.Binds
-
- // Docker is more flexible about its input where podman throws
- // away incorrectly formatted variables so we cannot reuse the
- // parsing of the env input
- // [Foo Other=one Blank=]
- imgEnv, err := newImage.Env(ctx)
- if err != nil {
- return createconfig.CreateConfig{}, err
- }
- input.Env = append(imgEnv, input.Env...)
- for _, e := range input.Env {
- splitEnv := strings.Split(e, "=")
- switch len(splitEnv) {
- case 0:
- continue
- case 1:
- env[splitEnv[0]] = ""
- default:
- env[splitEnv[0]] = strings.Join(splitEnv[1:], "=")
- }
- }
-
- // format the tmpfs mounts into a []string from map
- tmpfs := make([]string, 0, len(input.HostConfig.Tmpfs))
- for k, v := range input.HostConfig.Tmpfs {
- tmpfs = append(tmpfs, fmt.Sprintf("%s:%s", k, v))
- }
-
- if input.HostConfig.Init != nil && *input.HostConfig.Init {
- init = true
- }
-
- m := createconfig.CreateConfig{
- Annotations: nil, // podman
- Args: nil,
- Cgroup: c,
- CidFile: "",
- ConmonPidFile: "", // podman
- Command: input.Cmd,
- UserCommand: input.Cmd, // podman
- Detach: false, //
- // Devices: input.HostConfig.Devices,
- Entrypoint: input.Entrypoint,
- Env: env,
- HealthCheck: nil, //
- Init: init,
- InitPath: "", // tbd
- Image: input.Image,
- ImageID: newImage.ID(),
- BuiltinImgVolumes: nil, // podman
- ImageVolumeType: "", // podman
- Interactive: input.OpenStdin,
- // IpcMode: input.HostConfig.IpcMode,
- Labels: input.Labels,
- LogDriver: input.HostConfig.LogConfig.Type, // is this correct
- // LogDriverOpt: input.HostConfig.LogConfig.Config,
- Name: input.Name,
- Network: network,
- Pod: "", // podman
- PodmanPath: "", // podman
- Quiet: false, // front-end only
- Resources: createconfig.CreateResourceConfig{MemorySwappiness: -1},
- RestartPolicy: input.HostConfig.RestartPolicy.Name,
- Rm: input.HostConfig.AutoRemove,
- StopSignal: stopSignal,
- StopTimeout: stopTimeout,
- Systemd: false, // podman
- Tmpfs: tmpfs,
- User: z,
- Uts: uts,
- Tty: input.Tty,
- Mounts: nil, // we populate
- // MountsFlag: input.HostConfig.Mounts,
- NamedVolumes: nil, // we populate
- Volumes: volumes,
- VolumesFrom: input.HostConfig.VolumesFrom,
- WorkDir: workDir,
- Rootfs: "", // podman
- Security: security,
- Syslog: false, // podman
-
- Pid: pidConfig,
+ utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrap(err, "container create"))
+ return
}
-
- fullCmd := append(input.Entrypoint, input.Cmd...)
- if len(fullCmd) > 0 {
- m.PodmanPath = fullCmd[0]
- if len(fullCmd) == 1 {
- m.Args = fullCmd
- } else {
- m.Args = fullCmd[1:]
- }
+ createResponse := entities.ContainerCreateResponse{
+ ID: report.Id,
+ Warnings: []string{},
}
-
- return m, nil
+ utils.WriteResponse(w, http.StatusCreated, createResponse)
}
diff --git a/pkg/specgen/generate/oci.go b/pkg/specgen/generate/oci.go
index f02432f5b..8454458a8 100644
--- a/pkg/specgen/generate/oci.go
+++ b/pkg/specgen/generate/oci.go
@@ -110,7 +110,7 @@ func makeCommand(ctx context.Context, s *specgen.SpecGenerator, img *image.Image
// Only use image command if the user did not manually set an
// entrypoint.
command := s.Command
- if command == nil && img != nil && s.Entrypoint == nil {
+ if (command == nil || len(command) == 0) && img != nil && (s.Entrypoint == nil || len(s.Entrypoint) == 0) {
newCmd, err := img.Cmd(ctx)
if err != nil {
return nil, err
diff --git a/test/apiv2/01-basic.at b/test/apiv2/01-basic.at
index 9d4b04edb..f550d5fc3 100644
--- a/test/apiv2/01-basic.at
+++ b/test/apiv2/01-basic.at
@@ -59,7 +59,10 @@ t GET info 200 \
.DefaultRuntime~.*$runtime \
.MemTotal~[0-9]\\+
-# Timing: make sure server stays responsive
+# Timing: make sure server stays responsive.
+# Because /info may need to check storage, it may be slow the first time.
+# Let's invoke it once to prime caches, then run ten queries in a timed loop.
+t GET info 200
t0=$SECONDS
for i in $(seq 1 10); do
# FIXME: someday: refactor t(), separate out the 'curl' logic so we
@@ -70,7 +73,8 @@ t1=$SECONDS
delta_t=$((t1 - t2))
# Desired number of seconds in which we expect to run.
-want=7
+# FIXME: 10 seconds is a lot! PR #8076 opened to investigate why.
+want=10
if [ $delta_t -le $want ]; then
_show_ok 1 "Time for ten /info requests ($delta_t seconds) <= ${want}s"
else
diff --git a/test/apiv2/20-containers.at b/test/apiv2/20-containers.at
index 7fbcd2e9c..c7055dfc4 100644
--- a/test/apiv2/20-containers.at
+++ b/test/apiv2/20-containers.at
@@ -206,16 +206,6 @@ t POST containers/${cid_top}/stop "" 204
t DELETE containers/$cid 204
t DELETE containers/$cid_top 204
-# test the apiv2 create, shouldn't ignore the ENV and WORKDIR from the image
-t POST containers/create '"Image":"'$ENV_WORKDIR_IMG'","Env":["testKey1"]' 201 \
- .Id~[0-9a-f]\\{64\\}
-cid=$(jq -r '.Id' <<<"$output")
-t GET containers/$cid/json 200 \
- .Config.Env~.*REDIS_VERSION= \
- .Config.Env~.*testKey1= \
- .Config.WorkingDir="/data" # default is /data
-t DELETE containers/$cid 204
-
# test the WORKDIR and StopSignal
t POST containers/create '"Image":"'$ENV_WORKDIR_IMG'","WorkingDir":"/dataDir","StopSignal":"9"' 201 \
.Id~[0-9a-f]\\{64\\}
diff --git a/test/apiv2/test-apiv2 b/test/apiv2/test-apiv2
index 78325eb24..c8ca9df3f 100755
--- a/test/apiv2/test-apiv2
+++ b/test/apiv2/test-apiv2
@@ -179,7 +179,7 @@ function t() {
# POST requests require an extra params arg
if [[ $method = "POST" ]]; then
curl_args="-d $(jsonify $1)"
- testname="$testname [$1]"
+ testname="$testname [$curl_args]"
shift
fi
@@ -204,21 +204,30 @@ function t() {
echo "-------------------------------------------------------------" >>$LOG
echo "\$ $testname" >>$LOG
rm -f $WORKDIR/curl.*
- curl -s -X $method ${curl_args} \
- -H 'Content-type: application/json' \
- --dump-header $WORKDIR/curl.headers.out \
- -o $WORKDIR/curl.result.out "$url"
-
- if [[ $? -eq 7 ]]; then
- echo "FATAL: curl failure on $url - cannot continue" >&2
+ # -s = silent, but --write-out 'format' gives us important response data
+ response=$(curl -s -X $method ${curl_args} \
+ -H 'Content-type: application/json' \
+ --dump-header $WORKDIR/curl.headers.out \
+ --write-out '%{http_code}^%{content_type}^%{time_total}' \
+ -o $WORKDIR/curl.result.out "$url")
+
+ # Any error from curl is instant bad news, from which we can't recover
+ rc=$?
+ if [[ $rc -ne 0 ]]; then
+ echo "FATAL: curl failure ($rc) on $url - cannot continue" >&2
exit 1
fi
- cat $WORKDIR/curl.headers.out >>$LOG 2>/dev/null || true
+ # Show returned headers (without trailing ^M or empty lines) in log file.
+ # Sometimes -- I can't remember why! -- we don't get headers.
+ if [[ -e $WORKDIR/curl.headers.out ]]; then
+ tr -d '\015' < $WORKDIR/curl.headers.out | egrep '.' >>$LOG
+ fi
- # Log results, if text. If JSON, filter through jq for readability.
- content_type=$(sed -ne 's/^Content-Type:[ ]\+//pi' <$WORKDIR/curl.headers.out)
+ IFS='^' read actual_code content_type time_total <<<"$response"
+ printf "X-Response-Time: ${time_total}s\n\n" >>$LOG
+ # Log results, if text. If JSON, filter through jq for readability.
if [[ $content_type =~ /octet ]]; then
output="[$(file --brief $WORKDIR/curl.result.out)]"
echo "$output" >>$LOG
@@ -233,10 +242,8 @@ function t() {
fi
# Test return code
- actual_code=$(head -n1 $WORKDIR/curl.headers.out | awk '/^HTTP/ { print $2}')
is "$actual_code" "$expected_code" "$testname : status"
-
# Special case: 204/304, by definition, MUST NOT return content (rfc2616)
if [[ $expected_code = 204 || $expected_code = 304 ]]; then
if [ -n "$*" ]; then
diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go
index f69b6ca7b..83a66d2b9 100644
--- a/test/e2e/pod_create_test.go
+++ b/test/e2e/pod_create_test.go
@@ -245,6 +245,24 @@ var _ = Describe("Podman pod create", func() {
}
})
+ It("podman container in pod with IP address shares IP address", func() {
+ SkipIfRootless("Rootless does not support --ip")
+ podName := "test"
+ ctrName := "testCtr"
+ ip := GetRandomIPAddress()
+ podCreate := podmanTest.Podman([]string{"pod", "create", "--ip", ip, "--name", podName})
+ podCreate.WaitWithDefaultTimeout()
+ Expect(podCreate.ExitCode()).To(Equal(0))
+ podCtr := podmanTest.Podman([]string{"run", "--name", ctrName, "--pod", podName, "-d", "-t", ALPINE, "top"})
+ podCtr.WaitWithDefaultTimeout()
+ Expect(podCtr.ExitCode()).To(Equal(0))
+ ctrInspect := podmanTest.Podman([]string{"inspect", ctrName})
+ ctrInspect.WaitWithDefaultTimeout()
+ Expect(ctrInspect.ExitCode()).To(Equal(0))
+ ctrJSON := ctrInspect.InspectContainerToJSON()
+ Expect(ctrJSON[0].NetworkSettings.IPAddress).To(Equal(ip))
+ })
+
It("podman create pod with IP address and no infra should fail", func() {
name := "test"
ip := GetRandomIPAddress()
diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go
index 48ef566ce..c65738993 100644
--- a/test/e2e/ps_test.go
+++ b/test/e2e/ps_test.go
@@ -411,18 +411,43 @@ var _ = Describe("Podman ps", func() {
Expect(output).To(ContainSubstring(podName))
})
- It("podman ps test with port range", func() {
- session := podmanTest.RunTopContainer("")
+ It("podman ps test with single port range", func() {
+ session := podmanTest.Podman([]string{"run", "-dt", "-p", "2000-2006:2000-2006", ALPINE, "top"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- session = podmanTest.Podman([]string{"run", "-dt", "-p", "2000-2006:2000-2006", ALPINE, "top"})
+ session = podmanTest.Podman([]string{"ps", "--format", "{{.Ports}}"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.OutputToString()).To(ContainSubstring("0.0.0.0:2000-2006"))
+ })
+
+ It("podman ps test with invalid port range", func() {
+ session := podmanTest.Podman([]string{
+ "run", "-p", "1000-2000:2000-3000", "-p", "1999-2999:3001-4001", ALPINE,
+ })
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(125))
+ Expect(session.ErrorToString()).To(ContainSubstring("conflicting port mappings for host port 1999"))
+ })
+
+ It("podman ps test with multiple port range", func() {
+ session := podmanTest.Podman([]string{
+ "run", "-dt",
+ "-p", "3000-3001:3000-3001",
+ "-p", "3100-3102:4000-4002",
+ "-p", "30080:30080",
+ "-p", "30443:30443",
+ "-p", "8000:8080",
+ ALPINE, "top"},
+ )
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.Podman([]string{"ps", "--format", "{{.Ports}}"})
session.WaitWithDefaultTimeout()
- Expect(session.OutputToString()).To(ContainSubstring("0.0.0.0:2000-2006"))
+ Expect(session.OutputToString()).To(ContainSubstring(
+ "0.0.0.0:3000-3001->3000-3001/tcp, 0.0.0.0:3100-3102->4000-4002/tcp, 0.0.0.0:8000->8080/tcp, 0.0.0.0:30080->30080/tcp, 0.0.0.0:30443->30443/tcp",
+ ))
})
It("podman ps sync flag", func() {
diff --git a/test/e2e/toolbox_test.go b/test/e2e/toolbox_test.go
index 4f4113bd4..fbff8d19e 100644
--- a/test/e2e/toolbox_test.go
+++ b/test/e2e/toolbox_test.go
@@ -222,7 +222,7 @@ var _ = Describe("Toolbox-specific testing", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- Expect(WaitContainerReady(podmanTest, "test", "READY", 2, 1)).To(BeTrue())
+ Expect(WaitContainerReady(podmanTest, "test", "READY", 5, 1)).To(BeTrue())
expectedOutput := fmt.Sprintf("%s:x:%s:%s::%s:%s",
username, uid, gid, homeDir, shell)
@@ -257,7 +257,7 @@ var _ = Describe("Toolbox-specific testing", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- Expect(WaitContainerReady(podmanTest, "test", "READY", 2, 1)).To(BeTrue())
+ Expect(WaitContainerReady(podmanTest, "test", "READY", 5, 1)).To(BeTrue())
session = podmanTest.Podman([]string{"exec", "test", "cat", "/etc/group"})
session.WaitWithDefaultTimeout()
@@ -301,7 +301,7 @@ var _ = Describe("Toolbox-specific testing", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- Expect(WaitContainerReady(podmanTest, "test", "READY", 2, 1)).To(BeTrue())
+ Expect(WaitContainerReady(podmanTest, "test", "READY", 5, 1)).To(BeTrue())
expectedUser := fmt.Sprintf("%s:x:%s:%s::%s:%s",
username, uid, gid, homeDir, shell)
@@ -358,7 +358,7 @@ var _ = Describe("Toolbox-specific testing", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- Expect(WaitContainerReady(podmanTest, "test", "READY", 2, 1)).To(BeTrue())
+ Expect(WaitContainerReady(podmanTest, "test", "READY", 5, 1)).To(BeTrue())
session = podmanTest.Podman([]string{"logs", "test"})
session.WaitWithDefaultTimeout()
diff --git a/test/e2e/wait_test.go b/test/e2e/wait_test.go
index 4f0129a47..aa8a1f245 100644
--- a/test/e2e/wait_test.go
+++ b/test/e2e/wait_test.go
@@ -46,6 +46,7 @@ var _ = Describe("Podman wait", func() {
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.Podman([]string{"wait", cid})
session.Wait()
+ Expect(session.ExitCode()).To(Equal(0))
})
It("podman wait on a sleeping container", func() {
@@ -55,22 +56,60 @@ var _ = Describe("Podman wait", func() {
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.Podman([]string{"wait", cid})
session.Wait(20)
+ Expect(session.ExitCode()).To(Equal(0))
})
It("podman wait on latest container", func() {
session := podmanTest.Podman([]string{"run", "-d", ALPINE, "sleep", "1"})
session.Wait(20)
Expect(session.ExitCode()).To(Equal(0))
- session = podmanTest.Podman([]string{"wait", "-l"})
- session.Wait(20)
+ if IsRemote() {
+ session = podmanTest.Podman([]string{"wait", session.OutputToString()})
+ } else {
+ session = podmanTest.Podman([]string{"wait", "-l"})
+ }
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
})
It("podman container wait on latest container", func() {
session := podmanTest.Podman([]string{"container", "run", "-d", ALPINE, "sleep", "1"})
session.Wait(20)
Expect(session.ExitCode()).To(Equal(0))
- session = podmanTest.Podman([]string{"container", "wait", "-l"})
+ if IsRemote() {
+ session = podmanTest.Podman([]string{"container", "wait", session.OutputToString()})
+ } else {
+ session = podmanTest.Podman([]string{"container", "wait", "-l"})
+ }
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ })
+
+ It("podman container wait on latest container with --interval flag", func() {
+ session := podmanTest.Podman([]string{"container", "run", "-d", ALPINE, "sleep", "1"})
session.Wait(20)
+ Expect(session.ExitCode()).To(Equal(0))
+ session = podmanTest.Podman([]string{"container", "wait", "-i", "5000", session.OutputToString()})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ })
+
+ It("podman container wait on latest container with --interval flag", func() {
+ session := podmanTest.Podman([]string{"container", "run", "-d", ALPINE, "sleep", "1"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ session = podmanTest.Podman([]string{"container", "wait", "--interval", "1s", session.OutputToString()})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ })
+
+ It("podman container wait on container with bogus --interval", func() {
+ session := podmanTest.Podman([]string{"container", "run", "-d", ALPINE, "sleep", "1"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ session = podmanTest.Podman([]string{"container", "wait", "--interval", "100days", session.OutputToString()})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(125))
})
It("podman wait on three containers", func() {
diff --git a/test/system/015-help.bats b/test/system/015-help.bats
index 651fdcd09..22db8be8a 100644
--- a/test/system/015-help.bats
+++ b/test/system/015-help.bats
@@ -6,7 +6,7 @@
# provides its own --help output. If the usage message ends in '[command]',
# treat it as a subcommand, and recurse into its own list of sub-subcommands.
#
-# Any usage message that ends in '[flags]' is interpreted as a command
+# Any usage message that ends in '[options]' is interpreted as a command
# that takes no further arguments; we confirm by running with 'invalid-arg'
# and confirming that it exits with error status and message.
#
@@ -17,7 +17,7 @@ load helpers
function podman_commands() {
dprint "$@"
run_podman help "$@" |\
- awk '/^Available Commands:/{ok=1;next}/^Flags:/{ok=0}ok { print $1 }' |\
+ awk '/^Available Commands:/{ok=1;next}/^Options:/{ok=0}ok { print $1 }' |\
grep .
"$output"
}
@@ -42,7 +42,7 @@ function check_help() {
# e.g. 'podman ps' should not show 'podman container ps' in usage
# Trailing space in usage handles 'podman system renumber' which
- # has no ' [flags]'
+ # has no ' [options]'
is "$usage " " $command_string .*" "Usage string matches command"
# If usage ends in '[command]', recurse into subcommands
@@ -52,25 +52,25 @@ function check_help() {
continue
fi
- # We had someone write upper-case '[FLAGS]' once. Prevent it.
- if expr "$usage" : '.*\[FLAG' >/dev/null; then
- die "'flags' string must be lower-case in usage: $usage"
+ # We had someone write upper-case '[OPTIONS]' once. Prevent it.
+ if expr "$usage" : '.*\[OPTION' >/dev/null; then
+ die "'options' string must be lower-case in usage: $usage"
fi
- # We had someone do 'podman foo ARG [flags]' one time. Yeah, no.
- if expr "$usage" : '.*[A-Z].*\[flag' >/dev/null; then
- die "'flags' must precede arguments in usage: $usage"
+ # We had someone do 'podman foo ARG [options]' one time. Yeah, no.
+ if expr "$usage" : '.*[A-Z].*\[option' >/dev/null; then
+ die "'options' must precede arguments in usage: $usage"
fi
- # Cross-check: if usage includes '[flags]', there must be a
- # longer 'Flags:' section in the full --help output; vice-versa,
- # if 'Flags:' is in full output, usage line must have '[flags]'.
- if expr "$usage" : '.*\[flag' >/dev/null; then
- if ! expr "$full_help" : ".*Flags:" >/dev/null; then
- die "$command_string: Usage includes '[flags]' but has no 'Flags:' subsection"
+ # Cross-check: if usage includes '[options]', there must be a
+ # longer 'Options:' section in the full --help output; vice-versa,
+ # if 'Options:' is in full output, usage line must have '[options]'.
+ if expr "$usage" : '.*\[option' >/dev/null; then
+ if ! expr "$full_help" : ".*Options:" >/dev/null; then
+ die "$command_string: Usage includes '[options]' but has no 'Options:' subsection"
fi
- elif expr "$full_help" : ".*Flags:" >/dev/null; then
- die "$command_string: --help has 'Flags:' section but no '[flags]' in synopsis"
+ elif expr "$full_help" : ".*Options:" >/dev/null; then
+ die "$command_string: --help has 'Options:' section but no '[options]' in synopsis"
fi
# If usage lists no arguments (strings in ALL CAPS), confirm
@@ -102,7 +102,7 @@ function check_help() {
# If usage has required arguments, try running without them.
# The expression here is 'first capital letter is not in [BRACKETS]'.
- # It is intended to handle 'podman foo [flags] ARG' but not ' [ARG]'.
+ # It is intended to handle 'podman foo [options] ARG' but not ' [ARG]'.
if expr "$usage" : '[^A-Z]\+ [A-Z]' >/dev/null; then
# Exceptions: these commands don't work rootless
if is_rootless; then
diff --git a/test/system/260-sdnotify.bats b/test/system/260-sdnotify.bats
index 2ddeda96a..c99ba4fa6 100644
--- a/test/system/260-sdnotify.bats
+++ b/test/system/260-sdnotify.bats
@@ -107,6 +107,7 @@ function _assert_mainpid_is_conmon() {
# Done. Stop container, clean up.
run_podman exec $cid touch /stop
+ run_podman wait $cid
run_podman rm $cid
_stop_socat
}
@@ -142,6 +143,7 @@ function _assert_mainpid_is_conmon() {
# Done. Stop container, clean up.
run_podman exec $cid touch /stop
+ run_podman wait $cid
run_podman rm $cid
run_podman rmi $_FEDORA
_stop_socat
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 2f8a79aa8..9840261a9 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -701,7 +701,7 @@ gopkg.in/yaml.v3
# k8s.io/api v0.0.0-20190620084959-7cf5895f2711
k8s.io/api/apps/v1
k8s.io/api/core/v1
-# k8s.io/apimachinery v0.19.2
+# k8s.io/apimachinery v0.19.3
k8s.io/apimachinery/pkg/api/errors
k8s.io/apimachinery/pkg/api/resource
k8s.io/apimachinery/pkg/apis/meta/v1