summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/common/volumes.go22
-rw-r--r--cmd/podman/containers/create.go3
-rw-r--r--cmd/podman/containers/rm.go3
-rw-r--r--cmd/podman/containers/run.go3
-rw-r--r--cmd/podman/containers/runlabel.go3
-rw-r--r--cmd/podman/containers/stats.go9
-rw-r--r--cmd/podman/generate/systemd.go3
-rw-r--r--cmd/podman/images/build.go1
-rw-r--r--cmd/podman/images/list.go1
-rw-r--r--cmd/podman/images/load.go5
-rw-r--r--cmd/podman/images/pull.go16
-rw-r--r--cmd/podman/images/push.go17
-rw-r--r--cmd/podman/manifest/push.go38
-rw-r--r--cmd/podman/play/kube.go16
-rw-r--r--cmd/podman/pods/inspect.go13
-rw-r--r--cmd/podman/root.go2
-rw-r--r--cmd/podman/system/service.go23
-rw-r--r--cmd/podman/system/varlink.go7
18 files changed, 145 insertions, 40 deletions
diff --git a/cmd/podman/common/volumes.go b/cmd/podman/common/volumes.go
index 6b0b6e9cf..a70410ad3 100644
--- a/cmd/podman/common/volumes.go
+++ b/cmd/podman/common/volumes.go
@@ -209,9 +209,29 @@ func getBindMount(args []string) (spec.Mount, error) {
switch kv[0] {
case "bind-nonrecursive":
newMount.Options = append(newMount.Options, "bind")
+ case "readonly", "read-only":
+ if setRORW {
+ return newMount, errors.Wrapf(optionArgError, "cannot pass 'readonly', 'ro', or 'rw' options more than once")
+ }
+ setRORW = true
+ switch len(kv) {
+ case 1:
+ newMount.Options = append(newMount.Options, "ro")
+ case 2:
+ switch strings.ToLower(kv[1]) {
+ case "true":
+ newMount.Options = append(newMount.Options, "ro")
+ case "false":
+ // RW is default, so do nothing
+ default:
+ return newMount, errors.Wrapf(optionArgError, "readonly must be set to true or false, instead received %q", kv[1])
+ }
+ default:
+ return newMount, errors.Wrapf(optionArgError, "badly formatted option %q", val)
+ }
case "ro", "rw":
if setRORW {
- return newMount, errors.Wrapf(optionArgError, "cannot pass 'ro' or 'rw' options more than once")
+ return newMount, errors.Wrapf(optionArgError, "cannot pass 'readonly', 'ro', or 'rw' options more than once")
}
setRORW = true
// Can be formatted as one of:
diff --git a/cmd/podman/containers/create.go b/cmd/podman/containers/create.go
index bb6cb5fdd..c8007bc2f 100644
--- a/cmd/podman/containers/create.go
+++ b/cmd/podman/containers/create.go
@@ -62,6 +62,9 @@ func createFlags(flags *pflag.FlagSet) {
_ = flags.MarkHidden("env-host")
_ = flags.MarkHidden("http-proxy")
}
+ // Not sure we want these exposed yet. If we do, they need to be documented in man pages
+ _ = flags.MarkHidden("override-arch")
+ _ = flags.MarkHidden("override-os")
}
func init() {
diff --git a/cmd/podman/containers/rm.go b/cmd/podman/containers/rm.go
index f01462447..b25473a8d 100644
--- a/cmd/podman/containers/rm.go
+++ b/cmd/podman/containers/rm.go
@@ -74,8 +74,7 @@ func init() {
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: rmCommand,
})
- flags := rmCommand.Flags()
- rmFlags(flags)
+ rmFlags(rmCommand.Flags())
registry.Commands = append(registry.Commands, registry.CliCommand{
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
diff --git a/cmd/podman/containers/run.go b/cmd/podman/containers/run.go
index 2298691a9..890c6e827 100644
--- a/cmd/podman/containers/run.go
+++ b/cmd/podman/containers/run.go
@@ -63,6 +63,9 @@ func runFlags(flags *pflag.FlagSet) {
_ = flags.MarkHidden("env-host")
_ = flags.MarkHidden("http-proxy")
}
+ // Not sure we want these exposed yet. If we do, they need to be documented in man pages
+ _ = flags.MarkHidden("override-arch")
+ _ = flags.MarkHidden("override-os")
}
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
diff --git a/cmd/podman/containers/runlabel.go b/cmd/podman/containers/runlabel.go
index 11fa362b8..8d1c48ad2 100644
--- a/cmd/podman/containers/runlabel.go
+++ b/cmd/podman/containers/runlabel.go
@@ -42,7 +42,7 @@ func init() {
Parent: containerCmd,
})
- flags := rmCommand.Flags()
+ flags := runlabelCommand.Flags()
flags.StringVar(&runlabelOptions.Authfile, "authfile", auth.GetDefaultAuthFile(), "Path of the authentication file. Use REGISTRY_AUTH_FILE environment variable to override")
flags.StringVar(&runlabelOptions.CertDir, "cert-dir", "", "`Pathname` of a directory containing TLS certificates and keys")
flags.StringVar(&runlabelOptions.Credentials, "creds", "", "`Credentials` (USERNAME:PASSWORD) to use for authenticating to a registry")
@@ -61,6 +61,7 @@ func init() {
_ = flags.MarkHidden("opt1")
_ = flags.MarkHidden("opt2")
_ = flags.MarkHidden("opt3")
+ _ = flags.MarkHidden("signature-policy")
if err := flags.MarkDeprecated("pull", "podman will pull if not found in local storage"); err != nil {
logrus.Error("unable to mark pull flag deprecated")
diff --git a/cmd/podman/containers/stats.go b/cmd/podman/containers/stats.go
index 5b7f52cc7..c61b161e4 100644
--- a/cmd/podman/containers/stats.go
+++ b/cmd/podman/containers/stats.go
@@ -4,6 +4,7 @@ import (
"fmt"
"os"
"strings"
+ "sync"
"text/tabwriter"
"text/template"
@@ -111,14 +112,20 @@ func stats(cmd *cobra.Command, args []string) error {
}
}
statsOptions.StatChan = make(chan []*define.ContainerStats, 1)
+ wg := sync.WaitGroup{}
+ wg.Add(1)
go func() {
for reports := range statsOptions.StatChan {
if err := outputStats(reports); err != nil {
logrus.Error(err)
}
}
+ wg.Done()
+
}()
- return registry.ContainerEngine().ContainerStats(registry.Context(), args, statsOptions)
+ err := registry.ContainerEngine().ContainerStats(registry.Context(), args, statsOptions)
+ wg.Wait()
+ return err
}
func outputStats(reports []*define.ContainerStats) error {
diff --git a/cmd/podman/generate/systemd.go b/cmd/podman/generate/systemd.go
index 20d9748d4..75031e070 100644
--- a/cmd/podman/generate/systemd.go
+++ b/cmd/podman/generate/systemd.go
@@ -39,6 +39,9 @@ func init() {
flags.UintVarP(&systemdTimeout, "time", "t", containerConfig.Engine.StopTimeout, "Stop timeout override")
flags.StringVar(&systemdOptions.RestartPolicy, "restart-policy", "on-failure", "Systemd restart-policy")
flags.BoolVarP(&systemdOptions.New, "new", "", false, "Create a new container instead of starting an existing one")
+ flags.StringVar(&systemdOptions.ContainerPrefix, "container-prefix", "container", "Systemd unit name prefix for containers")
+ flags.StringVar(&systemdOptions.PodPrefix, "pod-prefix", "pod", "Systemd unit name prefix for pods")
+ flags.StringVar(&systemdOptions.Separator, "separator", "-", "Systemd unit name seperator between name/id and prefix")
flags.SetNormalizeFunc(utils.AliasFlags)
}
diff --git a/cmd/podman/images/build.go b/cmd/podman/images/build.go
index 06a7efd25..2efc795cd 100644
--- a/cmd/podman/images/build.go
+++ b/cmd/podman/images/build.go
@@ -126,6 +126,7 @@ func buildFlags(flags *pflag.FlagSet) {
os.Exit(1)
}
flags.AddFlagSet(&fromAndBudFlags)
+ _ = flags.MarkHidden("signature-policy")
}
// build executes the build command.
diff --git a/cmd/podman/images/list.go b/cmd/podman/images/list.go
index 022c90f71..4f8948b8b 100644
--- a/cmd/podman/images/list.go
+++ b/cmd/podman/images/list.go
@@ -74,7 +74,6 @@ func imageListFlagSet(flags *pflag.FlagSet) {
flags.BoolVar(&listFlag.digests, "digests", false, "Show digests")
flags.BoolVarP(&listFlag.noHeading, "noheading", "n", false, "Do not print column headings")
flags.BoolVar(&listFlag.noTrunc, "no-trunc", false, "Do not truncate output")
- flags.BoolVar(&listFlag.noTrunc, "notruncate", false, "Do not truncate output")
flags.BoolVarP(&listFlag.quiet, "quiet", "q", false, "Display only image IDs")
flags.StringVar(&listFlag.sort, "sort", "created", "Sort by "+sortFields.String())
flags.BoolVarP(&listFlag.history, "history", "", false, "Display the image name history")
diff --git a/cmd/podman/images/load.go b/cmd/podman/images/load.go
index 4bbffd432..a984ad81f 100644
--- a/cmd/podman/images/load.go
+++ b/cmd/podman/images/load.go
@@ -60,10 +60,7 @@ func loadFlags(flags *pflag.FlagSet) {
flags.StringVarP(&loadOpts.Input, "input", "i", "", "Read from specified archive file (default: stdin)")
flags.BoolVarP(&loadOpts.Quiet, "quiet", "q", false, "Suppress the output")
flags.StringVar(&loadOpts.SignaturePolicy, "signature-policy", "", "Pathname of signature policy file")
- if registry.IsRemote() {
- _ = flags.MarkHidden("signature-policy")
- }
-
+ _ = flags.MarkHidden("signature-policy")
}
func load(cmd *cobra.Command, args []string) error {
diff --git a/cmd/podman/images/pull.go b/cmd/podman/images/pull.go
index 9e883703f..9e137b5d6 100644
--- a/cmd/podman/images/pull.go
+++ b/cmd/podman/images/pull.go
@@ -8,6 +8,7 @@ import (
"github.com/containers/image/v5/types"
"github.com/containers/libpod/cmd/podman/registry"
"github.com/containers/libpod/pkg/domain/entities"
+ "github.com/containers/libpod/pkg/util"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
@@ -17,7 +18,8 @@ import (
// CLI-only fields into the API types.
type pullOptionsWrapper struct {
entities.ImagePullOptions
- TLSVerifyCLI bool // CLI only
+ TLSVerifyCLI bool // CLI only
+ CredentialsCLI string
}
var (
@@ -77,7 +79,7 @@ func pullFlags(flags *pflag.FlagSet) {
flags.BoolVar(&pullOptions.AllTags, "all-tags", false, "All tagged images in the repository will be pulled")
flags.StringVar(&pullOptions.Authfile, "authfile", auth.GetDefaultAuthFile(), "Path of the authentication file. Use REGISTRY_AUTH_FILE environment variable to override")
flags.StringVar(&pullOptions.CertDir, "cert-dir", "", "`Pathname` of a directory containing TLS certificates and keys")
- flags.StringVar(&pullOptions.Credentials, "creds", "", "`Credentials` (USERNAME:PASSWORD) to use for authenticating to a registry")
+ flags.StringVar(&pullOptions.CredentialsCLI, "creds", "", "`Credentials` (USERNAME:PASSWORD) to use for authenticating to a registry")
flags.StringVar(&pullOptions.OverrideArch, "override-arch", "", "Use `ARCH` instead of the architecture of the machine for choosing images")
flags.StringVar(&pullOptions.OverrideOS, "override-os", "", "Use `OS` instead of the running OS for choosing images")
flags.BoolVarP(&pullOptions.Quiet, "quiet", "q", false, "Suppress output information when pulling images")
@@ -87,9 +89,9 @@ func pullFlags(flags *pflag.FlagSet) {
if registry.IsRemote() {
_ = flags.MarkHidden("authfile")
_ = flags.MarkHidden("cert-dir")
- _ = flags.MarkHidden("signature-policy")
_ = flags.MarkHidden("tls-verify")
}
+ _ = flags.MarkHidden("signature-policy")
}
// imagePull is implement the command for pulling images.
@@ -107,6 +109,14 @@ func imagePull(cmd *cobra.Command, args []string) error {
}
}
+ if pullOptions.CredentialsCLI != "" {
+ creds, err := util.ParseRegistryCreds(pullOptions.CredentialsCLI)
+ if err != nil {
+ return err
+ }
+ pullOptions.Username = creds.Username
+ pullOptions.Password = creds.Password
+ }
// Let's do all the remaining Yoga in the API to prevent us from
// scattering logic across (too) many parts of the code.
pullReport, err := registry.ImageEngine().Pull(registry.GetContext(), args[0], pullOptions.ImagePullOptions)
diff --git a/cmd/podman/images/push.go b/cmd/podman/images/push.go
index dd536213f..a1614dc7a 100644
--- a/cmd/podman/images/push.go
+++ b/cmd/podman/images/push.go
@@ -7,6 +7,7 @@ import (
"github.com/containers/image/v5/types"
"github.com/containers/libpod/cmd/podman/registry"
"github.com/containers/libpod/pkg/domain/entities"
+ "github.com/containers/libpod/pkg/util"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
@@ -16,7 +17,8 @@ import (
// CLI-only fields into the API types.
type pushOptionsWrapper struct {
entities.ImagePushOptions
- TLSVerifyCLI bool // CLI only
+ TLSVerifyCLI bool // CLI only
+ CredentialsCLI string
}
var (
@@ -73,7 +75,7 @@ func pushFlags(flags *pflag.FlagSet) {
flags.StringVar(&pushOptions.Authfile, "authfile", auth.GetDefaultAuthFile(), "Path of the authentication file. Use REGISTRY_AUTH_FILE environment variable to override")
flags.StringVar(&pushOptions.CertDir, "cert-dir", "", "Path to a directory containing TLS certificates and keys")
flags.BoolVar(&pushOptions.Compress, "compress", false, "Compress tarball image layers when pushing to a directory using the 'dir' transport. (default is same compression type as source)")
- flags.StringVar(&pushOptions.Credentials, "creds", "", "`Credentials` (USERNAME:PASSWORD) to use for authenticating to a registry")
+ flags.StringVar(&pushOptions.CredentialsCLI, "creds", "", "`Credentials` (USERNAME:PASSWORD) to use for authenticating to a registry")
flags.StringVar(&pushOptions.DigestFile, "digestfile", "", "Write the digest of the pushed image to the specified file")
flags.StringVarP(&pushOptions.Format, "format", "f", "", "Manifest type (oci, v2s1, or v2s2) to use when pushing an image using the 'dir' transport (default is manifest type of source)")
flags.BoolVarP(&pushOptions.Quiet, "quiet", "q", false, "Suppress output information when pushing images")
@@ -87,9 +89,9 @@ func pushFlags(flags *pflag.FlagSet) {
_ = flags.MarkHidden("cert-dir")
_ = flags.MarkHidden("compress")
_ = flags.MarkHidden("quiet")
- _ = flags.MarkHidden("signature-policy")
_ = flags.MarkHidden("tls-verify")
}
+ _ = flags.MarkHidden("signature-policy")
}
// imagePush is implement the command for pushing images.
@@ -122,6 +124,15 @@ func imagePush(cmd *cobra.Command, args []string) error {
}
}
+ if pushOptions.CredentialsCLI != "" {
+ creds, err := util.ParseRegistryCreds(pushOptions.CredentialsCLI)
+ if err != nil {
+ return err
+ }
+ pushOptions.Username = creds.Username
+ pushOptions.Password = creds.Password
+ }
+
// Let's do all the remaining Yoga in the API to prevent us from scattering
// logic across (too) many parts of the code.
return registry.ImageEngine().Push(registry.GetContext(), source, destination, pushOptions.ImagePushOptions)
diff --git a/cmd/podman/manifest/push.go b/cmd/podman/manifest/push.go
index 49c76f40b..a2e68aff1 100644
--- a/cmd/podman/manifest/push.go
+++ b/cmd/podman/manifest/push.go
@@ -1,17 +1,26 @@
package manifest
import (
- "context"
-
"github.com/containers/common/pkg/auth"
+ "github.com/containers/image/v5/types"
"github.com/containers/libpod/cmd/podman/registry"
"github.com/containers/libpod/pkg/domain/entities"
+ "github.com/containers/libpod/pkg/util"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
+// manifestPushOptsWrapper wraps entities.ManifestPushOptions and prevents leaking
+// CLI-only fields into the API types.
+type manifestPushOptsWrapper struct {
+ entities.ManifestPushOptions
+
+ TLSVerifyCLI bool // CLI only
+ CredentialsCLI string
+}
+
var (
- manifestPushOpts = entities.ManifestPushOptions{}
+ manifestPushOpts = manifestPushOptsWrapper{}
pushCmd = &cobra.Command{
Use: "push [flags] SOURCE DESTINATION",
Short: "Push a manifest list or image index to a registry",
@@ -33,12 +42,12 @@ func init() {
flags.BoolVar(&manifestPushOpts.All, "all", false, "also push the images in the list")
flags.StringVar(&manifestPushOpts.Authfile, "authfile", auth.GetDefaultAuthFile(), "path of the authentication file. Use REGISTRY_AUTH_FILE environment variable to override")
flags.StringVar(&manifestPushOpts.CertDir, "cert-dir", "", "use certificates at the specified path to access the registry")
- flags.StringVar(&manifestPushOpts.Creds, "creds", "", "use `[username[:password]]` for accessing the registry")
+ flags.StringVar(&manifestPushOpts.CredentialsCLI, "creds", "", "use `[username[:password]]` for accessing the registry")
flags.StringVar(&manifestPushOpts.DigestFile, "digestfile", "", "after copying the image, write the digest of the resulting digest to the file")
flags.StringVarP(&manifestPushOpts.Format, "format", "f", "", "manifest type (oci or v2s2) to attempt to use when pushing the manifest list (default is manifest type of source)")
flags.BoolVarP(&manifestPushOpts.RemoveSignatures, "remove-signatures", "", false, "don't copy signatures when pushing images")
flags.StringVar(&manifestPushOpts.SignBy, "sign-by", "", "sign the image using a GPG key with the specified `FINGERPRINT`")
- flags.BoolVar(&manifestPushOpts.TlsVerify, "tls-verify", true, "require HTTPS and verify certificates when accessing the registry")
+ flags.BoolVar(&manifestPushOpts.TLSVerifyCLI, "tls-verify", true, "require HTTPS and verify certificates when accessing the registry")
flags.BoolVarP(&manifestPushOpts.Quiet, "quiet", "q", false, "don't output progress information when pushing lists")
if registry.IsRemote() {
_ = flags.MarkHidden("authfile")
@@ -59,7 +68,24 @@ func push(cmd *cobra.Command, args []string) error {
if destSpec == "" {
return errors.Errorf(`invalid destination "%s"`, destSpec)
}
- if err := registry.ImageEngine().ManifestPush(context.Background(), args, manifestPushOpts); err != nil {
+
+ if manifestPushOpts.CredentialsCLI != "" {
+ creds, err := util.ParseRegistryCreds(manifestPushOpts.CredentialsCLI)
+ if err != nil {
+ return err
+ }
+ manifestPushOpts.Username = creds.Username
+ manifestPushOpts.Password = creds.Password
+ }
+
+ // TLS verification in c/image is controlled via a `types.OptionalBool`
+ // which allows for distinguishing among set-true, set-false, unspecified
+ // which is important to implement a sane way of dealing with defaults of
+ // boolean CLI flags.
+ if cmd.Flags().Changed("tls-verify") {
+ manifestPushOpts.SkipTLSVerify = types.NewOptionalBool(!manifestPushOpts.TLSVerifyCLI)
+ }
+ if err := registry.ImageEngine().ManifestPush(registry.Context(), args, manifestPushOpts.ManifestPushOptions); err != nil {
return errors.Wrapf(err, "error pushing manifest %s to %s", listImageSpec, destSpec)
}
return nil
diff --git a/cmd/podman/play/kube.go b/cmd/podman/play/kube.go
index 2499b54b9..1fbf24d5e 100644
--- a/cmd/podman/play/kube.go
+++ b/cmd/podman/play/kube.go
@@ -9,6 +9,7 @@ import (
"github.com/containers/libpod/cmd/podman/registry"
"github.com/containers/libpod/cmd/podman/utils"
"github.com/containers/libpod/pkg/domain/entities"
+ "github.com/containers/libpod/pkg/util"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
@@ -18,7 +19,8 @@ import (
type playKubeOptionsWrapper struct {
entities.PlayKubeOptions
- TLSVerifyCLI bool
+ TLSVerifyCLI bool
+ CredentialsCLI string
}
var (
@@ -49,7 +51,7 @@ func init() {
flags := kubeCmd.Flags()
flags.SetNormalizeFunc(utils.AliasFlags)
- flags.StringVar(&kubeOptions.Credentials, "creds", "", "`Credentials` (USERNAME:PASSWORD) to use for authenticating to a registry")
+ flags.StringVar(&kubeOptions.CredentialsCLI, "creds", "", "`Credentials` (USERNAME:PASSWORD) to use for authenticating to a registry")
flags.StringVar(&kubeOptions.Network, "network", "", "Connect pod to CNI network(s)")
flags.BoolVarP(&kubeOptions.Quiet, "quiet", "q", false, "Suppress output information when pulling images")
if !registry.IsRemote() {
@@ -59,6 +61,8 @@ func init() {
flags.StringVar(&kubeOptions.SignaturePolicy, "signature-policy", "", "`Pathname` of signature policy file (not usually used)")
flags.StringVar(&kubeOptions.SeccompProfileRoot, "seccomp-profile-root", defaultSeccompRoot, "Directory path for seccomp profiles")
}
+
+ _ = flags.MarkHidden("signature-policy")
}
func kube(cmd *cobra.Command, args []string) error {
@@ -74,6 +78,14 @@ func kube(cmd *cobra.Command, args []string) error {
return errors.Wrapf(err, "error getting authfile %s", kubeOptions.Authfile)
}
}
+ if kubeOptions.CredentialsCLI != "" {
+ creds, err := util.ParseRegistryCreds(kubeOptions.CredentialsCLI)
+ if err != nil {
+ return err
+ }
+ kubeOptions.Username = creds.Username
+ kubeOptions.Password = creds.Password
+ }
report, err := registry.ContainerEngine().PlayKube(registry.GetContext(), args[0], kubeOptions.PlayKubeOptions)
if err != nil {
diff --git a/cmd/podman/pods/inspect.go b/cmd/podman/pods/inspect.go
index 1e333247b..34c07c11b 100644
--- a/cmd/podman/pods/inspect.go
+++ b/cmd/podman/pods/inspect.go
@@ -4,6 +4,7 @@ import (
"context"
"fmt"
+ "github.com/containers/buildah/pkg/formats"
"github.com/containers/libpod/cmd/podman/registry"
"github.com/containers/libpod/pkg/domain/entities"
"github.com/pkg/errors"
@@ -36,6 +37,7 @@ func init() {
})
flags := inspectCmd.Flags()
flags.BoolVarP(&inspectOptions.Latest, "latest", "l", false, "Act on the latest pod podman is aware of")
+ flags.StringVarP(&inspectOptions.Format, "format", "f", "json", "Format the output to a Go template or json")
if registry.IsRemote() {
_ = flags.MarkHidden("latest")
}
@@ -54,10 +56,11 @@ func inspect(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
- b, err := json.MarshalIndent(responses, "", " ")
- if err != nil {
- return err
+ var data interface{} = responses
+ var out formats.Writer = formats.JSONStruct{Output: data}
+ if inspectOptions.Format != "json" {
+ out = formats.StdoutTemplate{Output: data, Template: inspectOptions.Format}
}
- fmt.Println(string(b))
- return nil
+
+ return out.Out()
}
diff --git a/cmd/podman/root.go b/cmd/podman/root.go
index dffd9b534..3796b8e27 100644
--- a/cmd/podman/root.go
+++ b/cmd/podman/root.go
@@ -206,6 +206,7 @@ func rootFlags(opts *entities.PodmanConfig, flags *pflag.FlagSet) {
flags.IntVar(&opts.MaxWorks, "max-workers", 0, "The maximum number of workers for parallel operations")
flags.StringVar(&cfg.Engine.Namespace, "namespace", cfg.Engine.Namespace, "Set the libpod namespace, used to create separate views of the containers and pods on the system")
flags.StringVar(&cfg.Engine.StaticDir, "root", "", "Path to the root directory in which data, including images, is stored")
+ flags.StringVar(&opts.RegistriesConf, "registries-conf", "", "Path to a registries.conf to use for image processing")
flags.StringVar(&opts.Runroot, "runroot", "", "Path to the 'run directory' where all state information is stored")
flags.StringVar(&opts.RuntimePath, "runtime", "", "Path to the OCI-compatible binary used to run containers, default is /usr/bin/runc")
// -s is deprecated due to conflict with -s on subcommands
@@ -225,6 +226,7 @@ func rootFlags(opts *entities.PodmanConfig, flags *pflag.FlagSet) {
"cpu-profile",
"default-mounts-file",
"max-workers",
+ "registries-conf",
"trace",
} {
if err := flags.MarkHidden(f); err != nil {
diff --git a/cmd/podman/system/service.go b/cmd/podman/system/service.go
index b5dd2f2aa..0f42ae28b 100644
--- a/cmd/podman/system/service.go
+++ b/cmd/podman/system/service.go
@@ -17,6 +17,7 @@ import (
"github.com/containers/libpod/pkg/util"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
+ "github.com/spf13/pflag"
)
var (
@@ -26,13 +27,12 @@ Enable a listening service for API access to Podman commands.
`
srvCmd = &cobra.Command{
- Use: "service [flags] [URI]",
- Args: cobra.MaximumNArgs(1),
- Short: "Run API service",
- Long: srvDescription,
- RunE: service,
- Example: `podman system service --time=0 unix:///tmp/podman.sock
- podman system service --varlink --time=0 unix:///tmp/podman.sock`,
+ Use: "service [flags] [URI]",
+ Args: cobra.MaximumNArgs(1),
+ Short: "Run API service",
+ Long: srvDescription,
+ RunE: service,
+ Example: `podman system service --time=0 unix:///tmp/podman.sock`,
}
srvArgs = struct {
@@ -50,10 +50,17 @@ func init() {
flags := srvCmd.Flags()
flags.Int64VarP(&srvArgs.Timeout, "time", "t", 5, "Time until the service session expires in seconds. Use 0 to disable the timeout")
- flags.Int64Var(&srvArgs.Timeout, "timeout", 5, "Time until the service session expires in seconds. Use 0 to disable the timeout")
flags.BoolVar(&srvArgs.Varlink, "varlink", false, "Use legacy varlink service instead of REST")
_ = flags.MarkDeprecated("varlink", "valink API is deprecated.")
+ flags.SetNormalizeFunc(aliasTimeoutFlag)
+}
+
+func aliasTimeoutFlag(_ *pflag.FlagSet, name string) pflag.NormalizedName {
+ if name == "timeout" {
+ name = "time"
+ }
+ return pflag.NormalizedName(name)
}
func service(cmd *cobra.Command, args []string) error {
diff --git a/cmd/podman/system/varlink.go b/cmd/podman/system/varlink.go
index c83f5ff76..6a38b3d28 100644
--- a/cmd/podman/system/varlink.go
+++ b/cmd/podman/system/varlink.go
@@ -1,3 +1,5 @@
+// +build linux
+
package system
import (
@@ -20,7 +22,7 @@ var (
Long: varlinkDescription,
RunE: varlinkE,
Example: `podman varlink unix:/run/podman/io.podman
- podman varlink --timeout 5000 unix:/run/podman/io.podman`,
+ podman varlink --time 5000 unix:/run/podman/io.podman`,
}
varlinkArgs = struct {
Timeout int64
@@ -34,8 +36,7 @@ func init() {
})
flags := varlinkCmd.Flags()
flags.Int64VarP(&varlinkArgs.Timeout, "time", "t", 1000, "Time until the varlink session expires in milliseconds. Use 0 to disable the timeout")
- flags.Int64Var(&varlinkArgs.Timeout, "timeout", 1000, "Time until the varlink session expires in milliseconds. Use 0 to disable the timeout")
-
+ flags.SetNormalizeFunc(aliasTimeoutFlag)
}
func varlinkE(cmd *cobra.Command, args []string) error {