diff options
-rw-r--r-- | cmd/podman/registry/config.go | 29 | ||||
-rw-r--r-- | cmd/podman/registry/config_abi.go | 7 | ||||
-rw-r--r-- | cmd/podman/registry/config_tunnel.go | 7 | ||||
-rw-r--r-- | cmd/podman/registry/registry.go | 20 | ||||
-rw-r--r-- | cmd/podman/root.go | 2 | ||||
-rw-r--r-- | cmd/podman/system/service.go | 2 | ||||
-rw-r--r-- | docs/source/markdown/podman-create.1.md | 12 | ||||
-rw-r--r-- | docs/source/markdown/podman-run.1.md | 5 | ||||
-rw-r--r-- | troubleshooting.md | 2 |
9 files changed, 60 insertions, 26 deletions
diff --git a/cmd/podman/registry/config.go b/cmd/podman/registry/config.go index fc6eb538e..49d5bca74 100644 --- a/cmd/podman/registry/config.go +++ b/cmd/podman/registry/config.go @@ -22,6 +22,7 @@ const ( var ( podmanOptions entities.PodmanConfig podmanSync sync.Once + abiSupport = false ) // PodmanConfig returns an entities.PodmanConfig built up from @@ -39,23 +40,31 @@ func newPodmanConfig() { var mode entities.EngineMode switch runtime.GOOS { - case "darwin": - fallthrough - case "windows": + case "darwin", "windows": mode = entities.TunnelMode case "linux": - mode = entities.ABIMode + // Some linux clients might only be compiled without ABI + // support (e.g., podman-remote). + if abiSupport { + mode = entities.ABIMode + } else { + mode = entities.TunnelMode + } default: fmt.Fprintf(os.Stderr, "%s is not a supported OS", runtime.GOOS) os.Exit(1) } - // cobra.Execute() may not be called yet, so we peek at os.Args. - for _, v := range os.Args { - // Prefix checking works because of how default EngineMode's - // have been defined. - if strings.HasPrefix(v, "--remote") { - mode = entities.TunnelMode + // Check if need to fallback to the tunnel mode if --remote is used. + if abiSupport && mode == entities.ABIMode { + // cobra.Execute() may not be called yet, so we peek at os.Args. + for _, v := range os.Args { + // Prefix checking works because of how default EngineMode's + // have been defined. + if strings.HasPrefix(v, "--remote") { + mode = entities.TunnelMode + break + } } } diff --git a/cmd/podman/registry/config_abi.go b/cmd/podman/registry/config_abi.go new file mode 100644 index 000000000..55430e1bf --- /dev/null +++ b/cmd/podman/registry/config_abi.go @@ -0,0 +1,7 @@ +// +build ABISupport + +package registry + +func init() { + abiSupport = true +} diff --git a/cmd/podman/registry/config_tunnel.go b/cmd/podman/registry/config_tunnel.go new file mode 100644 index 000000000..29e744dac --- /dev/null +++ b/cmd/podman/registry/config_tunnel.go @@ -0,0 +1,7 @@ +// +build !ABISupport + +package registry + +func init() { + abiSupport = false +} diff --git a/cmd/podman/registry/registry.go b/cmd/podman/registry/registry.go index 69e2babfc..71ee2bed0 100644 --- a/cmd/podman/registry/registry.go +++ b/cmd/podman/registry/registry.go @@ -2,14 +2,18 @@ package registry import ( "context" + "path/filepath" "github.com/containers/libpod/pkg/domain/entities" "github.com/containers/libpod/pkg/domain/infra" + "github.com/containers/libpod/pkg/rootless" + "github.com/containers/libpod/pkg/util" + "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) -// DefaultAPIAddress is the default address of the REST socket -const DefaultAPIAddress = "unix:/run/podman/podman.sock" +// DefaultRootAPIAddress is the default address of the REST socket +const DefaultRootAPIAddress = "unix:/run/podman/podman.sock" // DefaultVarlinkAddress is the default address of the varlink socket const DefaultVarlinkAddress = "unix:/run/podman/io.podman" @@ -98,3 +102,15 @@ func GetContextWithOptions() context.Context { func GetContext() context.Context { return Context() } + +func DefaultAPIAddress() string { + if rootless.IsRootless() { + xdg, err := util.GetRuntimeDir() + if err != nil { + logrus.Warnf("Failed to get rootless runtime dir for DefaultAPIAddress: %s", err) + return DefaultRootAPIAddress + } + return "unix:" + filepath.Join(xdg, "podman", "podman.sock") + } + return DefaultRootAPIAddress +} diff --git a/cmd/podman/root.go b/cmd/podman/root.go index 502b6c03c..7d6f6f823 100644 --- a/cmd/podman/root.go +++ b/cmd/podman/root.go @@ -208,7 +208,7 @@ func syslogHook() { func rootFlags(opts *entities.PodmanConfig, flags *pflag.FlagSet) { // V2 flags - flags.StringVarP(&opts.Uri, "remote", "r", "", "URL to access Podman service") + flags.StringVarP(&opts.Uri, "remote", "r", registry.DefaultAPIAddress(), "URL to access Podman service") flags.StringSliceVar(&opts.Identities, "identity", []string{}, "path to SSH identity file") cfg := opts.Config diff --git a/cmd/podman/system/service.go b/cmd/podman/system/service.go index f4b91dd78..552c72f79 100644 --- a/cmd/podman/system/service.go +++ b/cmd/podman/system/service.go @@ -139,6 +139,6 @@ func resolveApiURI(_url []string) (string, error) { case srvArgs.Varlink: return registry.DefaultVarlinkAddress, nil default: - return registry.DefaultAPIAddress, nil + return registry.DefaultRootAPIAddress, nil } } diff --git a/docs/source/markdown/podman-create.1.md b/docs/source/markdown/podman-create.1.md index 2fd8512a6..475634fde 100644 --- a/docs/source/markdown/podman-create.1.md +++ b/docs/source/markdown/podman-create.1.md @@ -358,12 +358,12 @@ Defaults to `true` **--image-volume**, **builtin-volume**=*bind|tmpfs|ignore* -Tells Podman how to handle the builtin image volumes. The options are: 'bind', 'tmpfs', or 'ignore' (default 'bind'). -bind: A directory is created inside the container state directory and bind mounted into -the container for the volumes. -tmpfs: The volume is mounted onto the container as a tmpfs, which allows the users to create +Tells Podman how to handle the builtin image volumes. Default is **bind**. + +- **bind**: An anonymous named volume will be created and mounted into the container. +- **tmpfs**: The volume is mounted onto the container as a tmpfs, which allows the users to create content that disappears when the container is stopped. -ignore: All volumes are just ignored and no action is taken. +- **ignore**: All volumes are just ignored and no action is taken. **--init** @@ -445,8 +445,6 @@ Remember that the MAC address in an Ethernet network must be unique. The IPv6 link-local address will be based on the device's MAC address according to RFC4862. -Not currently supported - **--memory**, **-m**=*limit* Memory limit (format: <number>[<unit>], where unit = b (bytes), k (kilobytes), m (megabytes), or g (gigabytes)) diff --git a/docs/source/markdown/podman-run.1.md b/docs/source/markdown/podman-run.1.md index dd221590d..4c236b520 100644 --- a/docs/source/markdown/podman-run.1.md +++ b/docs/source/markdown/podman-run.1.md @@ -371,8 +371,7 @@ Defaults to **true**. Tells Podman how to handle the builtin image volumes. Default is **bind**. -- **bind**: A directory is created inside the container state directory and bind mounted into -the container for the volumes. +- **bind**: An anonymous named volume will be created and mounted into the container. - **tmpfs**: The volume is mounted onto the container as a tmpfs, which allows the users to create content that disappears when the container is stopped. - **ignore**: All volumes are just ignored and no action is taken. @@ -454,8 +453,6 @@ Remember that the MAC address in an Ethernet network must be unique. The IPv6 link-local address will be based on the device's MAC address according to RFC4862. -Not currently supported - **--memory**, **-m**=_number_[_unit_] Memory limit. A _unit_ can be **b** (bytes), **k** (kilobytes), **m** (megabytes), or **g** (gigabytes). diff --git a/troubleshooting.md b/troubleshooting.md index 14d1a867e..f04d9e9fa 100644 --- a/troubleshooting.md +++ b/troubleshooting.md @@ -320,7 +320,7 @@ under `/var/lib/containers/storage`. ``` semanage fcontext -a -e /var/lib/containers /srv/containers -restorecon -R -v /src/containers +restorecon -R -v /srv/containers ``` The semanage command above tells SELinux to setup the default labeling of |