summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/README.md20
-rw-r--r--cmd/podman/auto-update.go6
-rw-r--r--cmd/podman/common/create.go15
-rw-r--r--cmd/podman/common/create_opts.go5
-rw-r--r--cmd/podman/common/createparse.go2
-rw-r--r--cmd/podman/common/default.go2
-rw-r--r--cmd/podman/common/netflags.go16
-rw-r--r--cmd/podman/common/specgen.go91
-rw-r--r--cmd/podman/common/util.go2
-rw-r--r--cmd/podman/common/volumes.go99
-rw-r--r--cmd/podman/containers/attach.go6
-rw-r--r--cmd/podman/containers/checkpoint.go10
-rw-r--r--cmd/podman/containers/cleanup.go8
-rw-r--r--cmd/podman/containers/commit.go4
-rw-r--r--cmd/podman/containers/container.go8
-rw-r--r--cmd/podman/containers/cp.go8
-rw-r--r--cmd/podman/containers/create.go18
-rw-r--r--cmd/podman/containers/diff.go8
-rw-r--r--cmd/podman/containers/exec.go10
-rw-r--r--cmd/podman/containers/exists.go4
-rw-r--r--cmd/podman/containers/export.go6
-rw-r--r--cmd/podman/containers/init.go8
-rw-r--r--cmd/podman/containers/inspect.go8
-rw-r--r--cmd/podman/containers/kill.go10
-rw-r--r--cmd/podman/containers/list.go6
-rw-r--r--cmd/podman/containers/logs.go8
-rw-r--r--cmd/podman/containers/mount.go25
-rw-r--r--cmd/podman/containers/pause.go8
-rw-r--r--cmd/podman/containers/port.go6
-rw-r--r--cmd/podman/containers/prune.go6
-rw-r--r--cmd/podman/containers/ps.go6
-rw-r--r--cmd/podman/containers/restart.go10
-rw-r--r--cmd/podman/containers/restore.go10
-rw-r--r--cmd/podman/containers/rm.go10
-rw-r--r--cmd/podman/containers/run.go16
-rw-r--r--cmd/podman/containers/runlabel.go4
-rw-r--r--cmd/podman/containers/start.go12
-rw-r--r--cmd/podman/containers/stats.go14
-rw-r--r--cmd/podman/containers/stop.go8
-rw-r--r--cmd/podman/containers/top.go8
-rw-r--r--cmd/podman/containers/unmount.go49
-rw-r--r--cmd/podman/containers/unpause.go8
-rw-r--r--cmd/podman/containers/wait.go10
-rw-r--r--cmd/podman/diff.go10
-rw-r--r--cmd/podman/early_init_linux.go39
-rw-r--r--cmd/podman/early_init_unsupported.go6
-rw-r--r--cmd/podman/generate/generate.go8
-rw-r--r--cmd/podman/generate/kube.go6
-rw-r--r--cmd/podman/generate/systemd.go6
-rw-r--r--cmd/podman/healthcheck/healthcheck.go6
-rw-r--r--cmd/podman/healthcheck/run.go4
-rw-r--r--cmd/podman/images/build.go58
-rw-r--r--cmd/podman/images/diff.go6
-rw-r--r--cmd/podman/images/exists.go4
-rw-r--r--cmd/podman/images/history.go4
-rw-r--r--cmd/podman/images/image.go6
-rw-r--r--cmd/podman/images/images.go4
-rw-r--r--cmd/podman/images/import.go6
-rw-r--r--cmd/podman/images/inspect.go6
-rw-r--r--cmd/podman/images/list.go57
-rw-r--r--cmd/podman/images/load.go8
-rw-r--r--cmd/podman/images/mount.go139
-rw-r--r--cmd/podman/images/prune.go8
-rw-r--r--cmd/podman/images/pull.go7
-rw-r--r--cmd/podman/images/push.go7
-rw-r--r--cmd/podman/images/rm.go6
-rw-r--r--cmd/podman/images/rmi.go4
-rw-r--r--cmd/podman/images/save.go10
-rw-r--r--cmd/podman/images/search.go6
-rw-r--r--cmd/podman/images/sign.go4
-rw-r--r--cmd/podman/images/tag.go4
-rw-r--r--cmd/podman/images/tree.go4
-rw-r--r--cmd/podman/images/trust.go6
-rw-r--r--cmd/podman/images/trust_set.go8
-rw-r--r--cmd/podman/images/trust_show.go4
-rw-r--r--cmd/podman/images/unmount.go71
-rw-r--r--cmd/podman/images/untag.go4
-rw-r--r--cmd/podman/inspect.go6
-rw-r--r--cmd/podman/inspect/inspect.go6
-rw-r--r--cmd/podman/login.go6
-rw-r--r--cmd/podman/logout.go6
-rw-r--r--cmd/podman/main.go45
-rw-r--r--cmd/podman/manifest/add.go4
-rw-r--r--cmd/podman/manifest/annotate.go4
-rw-r--r--cmd/podman/manifest/create.go4
-rw-r--r--cmd/podman/manifest/inspect.go4
-rw-r--r--cmd/podman/manifest/manifest.go6
-rw-r--r--cmd/podman/manifest/push.go6
-rw-r--r--cmd/podman/manifest/remove.go4
-rw-r--r--cmd/podman/networks/create.go8
-rw-r--r--cmd/podman/networks/inspect.go6
-rw-r--r--cmd/podman/networks/list.go10
-rw-r--r--cmd/podman/networks/network.go6
-rw-r--r--cmd/podman/networks/rm.go6
-rw-r--r--cmd/podman/play/kube.go8
-rw-r--r--cmd/podman/play/play.go6
-rw-r--r--cmd/podman/pods/create.go16
-rw-r--r--cmd/podman/pods/exists.go4
-rw-r--r--cmd/podman/pods/inspect.go6
-rw-r--r--cmd/podman/pods/kill.go8
-rw-r--r--cmd/podman/pods/pause.go8
-rw-r--r--cmd/podman/pods/pod.go8
-rw-r--r--cmd/podman/pods/prune.go6
-rw-r--r--cmd/podman/pods/ps.go6
-rw-r--r--cmd/podman/pods/restart.go8
-rw-r--r--cmd/podman/pods/rm.go10
-rw-r--r--cmd/podman/pods/start.go10
-rw-r--r--cmd/podman/pods/stats.go8
-rw-r--r--cmd/podman/pods/stop.go10
-rw-r--r--cmd/podman/pods/top.go8
-rw-r--r--cmd/podman/pods/unpause.go8
-rw-r--r--cmd/podman/registry/config.go16
-rw-r--r--cmd/podman/registry/registry.go8
-rw-r--r--cmd/podman/registry/remote.go2
-rw-r--r--cmd/podman/report/diff.go2
-rw-r--r--cmd/podman/report/report.go2
-rw-r--r--cmd/podman/root.go46
-rw-r--r--cmd/podman/system/connection.go204
-rw-r--r--cmd/podman/system/connection/add.go223
-rw-r--r--cmd/podman/system/connection/default.go46
-rw-r--r--cmd/podman/system/connection/list.go84
-rw-r--r--cmd/podman/system/connection/remove.go49
-rw-r--r--cmd/podman/system/connection/rename.go54
-rw-r--r--cmd/podman/system/df.go8
-rw-r--r--cmd/podman/system/events.go10
-rw-r--r--cmd/podman/system/info.go8
-rw-r--r--cmd/podman/system/migrate.go8
-rw-r--r--cmd/podman/system/prune.go8
-rw-r--r--cmd/podman/system/renumber.go10
-rw-r--r--cmd/podman/system/reset.go8
-rw-r--r--cmd/podman/system/service.go10
-rw-r--r--cmd/podman/system/service_abi.go6
-rw-r--r--cmd/podman/system/system.go6
-rw-r--r--cmd/podman/system/unshare.go6
-rw-r--r--cmd/podman/system/varlink.go4
-rw-r--r--cmd/podman/system/version.go10
-rw-r--r--cmd/podman/utils/utils.go2
-rw-r--r--cmd/podman/validate/latest.go2
-rw-r--r--cmd/podman/volumes/create.go6
-rw-r--r--cmd/podman/volumes/inspect.go6
-rw-r--r--cmd/podman/volumes/list.go8
-rw-r--r--cmd/podman/volumes/prune.go8
-rw-r--r--cmd/podman/volumes/rm.go6
-rw-r--r--cmd/podman/volumes/volume.go6
144 files changed, 1474 insertions, 817 deletions
diff --git a/cmd/podman/README.md b/cmd/podman/README.md
index da92d0216..260c9bcfc 100644
--- a/cmd/podman/README.md
+++ b/cmd/podman/README.md
@@ -12,16 +12,16 @@ See items below for details on building, installing, contributing to Podman:
## Adding a new command `podman manifest`
```shell script
-$ mkdir -p $GOPATH/src/github.com/containers/libpod/cmd/podmanV2/manifests
+$ mkdir -p $GOPATH/src/github.com/containers/podman/cmd/podmanV2/manifests
```
-Create the file ```$GOPATH/src/github.com/containers/libpod/cmd/podmanV2/manifests/manifest.go```
+Create the file ```$GOPATH/src/github.com/containers/podman/cmd/podmanV2/manifests/manifest.go```
```go
package manifests
import (
- "github.com/containers/libpod/cmd/podman/registry"
- "github.com/containers/libpod/cmd/podman/validate"
- "github.com/containers/libpod/pkg/domain/entities"
+ "github.com/containers/podman/cmd/podman/registry"
+ "github.com/containers/podman/cmd/podman/validate"
+ "github.com/containers/podman/pkg/domain/entities"
"github.com/spf13/cobra"
)
@@ -47,21 +47,21 @@ func init() {
})
}
```
-To "wire" in the `manifest` command, edit the file ```$GOPATH/src/github.com/containers/libpod/cmd/podmanV2/main.go``` to add:
+To "wire" in the `manifest` command, edit the file ```$GOPATH/src/github.com/containers/podman/cmd/podmanV2/main.go``` to add:
```go
package main
-import _ "github.com/containers/libpod/cmd/podman/manifests"
+import _ "github.com/containers/podman/cmd/podman/manifests"
```
## Adding a new sub command `podman manifests list`
-Create the file ```$GOPATH/src/github.com/containers/libpod/cmd/podmanV2/manifests/inspect.go```
+Create the file ```$GOPATH/src/github.com/containers/podman/cmd/podmanV2/manifests/inspect.go```
```go
package manifests
import (
- "github.com/containers/libpod/cmd/podman/registry"
- "github.com/containers/libpod/pkg/domain/entities"
+ "github.com/containers/podman/cmd/podman/registry"
+ "github.com/containers/podman/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/auto-update.go b/cmd/podman/auto-update.go
index a12eeb6cb..8e17b49e0 100644
--- a/cmd/podman/auto-update.go
+++ b/cmd/podman/auto-update.go
@@ -4,9 +4,9 @@ import (
"fmt"
"github.com/containers/common/pkg/auth"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/errorhandling"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/errorhandling"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/common/create.go b/cmd/podman/common/create.go
index a26bbf718..e96b6a8d6 100644
--- a/cmd/podman/common/create.go
+++ b/cmd/podman/common/create.go
@@ -5,8 +5,8 @@ import (
"os"
"github.com/containers/common/pkg/auth"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/libpod/define"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/libpod/define"
"github.com/spf13/pflag"
)
@@ -155,6 +155,10 @@ func GetCreateFlags(cf *ContainerCLIOpts) *pflag.FlagSet {
"device-write-iops", []string{},
"Limit write rate (IO per second) to a device (e.g. --device-write-iops=/dev/sda:1000)",
)
+ createFlags.Bool(
+ "disable-content-trust", false,
+ "This is a Docker specific option and is a NOOP",
+ )
createFlags.String("entrypoint", "",
"Overwrite the default ENTRYPOINT of the image",
)
@@ -401,7 +405,7 @@ func GetCreateFlags(cf *ContainerCLIOpts) *pflag.FlagSet {
)
createFlags.StringArrayVar(
&cf.SecurityOpt,
- "security-opt", containerConfig.SecurityOptions(),
+ "security-opt", []string{},
"Security Options",
)
createFlags.String(
@@ -459,6 +463,11 @@ func GetCreateFlags(cf *ContainerCLIOpts) *pflag.FlagSet {
"tz", containerConfig.TZ(),
"Set timezone in container",
)
+ createFlags.StringVar(
+ &cf.Umask,
+ "umask", containerConfig.Umask(),
+ "Set umask in container",
+ )
createFlags.StringSliceVar(
&cf.UIDMap,
"uidmap", []string{},
diff --git a/cmd/podman/common/create_opts.go b/cmd/podman/common/create_opts.go
index a544846aa..f9e4d7ca5 100644
--- a/cmd/podman/common/create_opts.go
+++ b/cmd/podman/common/create_opts.go
@@ -1,6 +1,6 @@
package common
-import "github.com/containers/libpod/v2/pkg/domain/entities"
+import "github.com/containers/podman/v2/pkg/domain/entities"
type ContainerCLIOpts struct {
Annotation []string
@@ -10,7 +10,7 @@ type ContainerCLIOpts struct {
BlkIOWeightDevice []string
CapAdd []string
CapDrop []string
- CGroupsNS string
+ CgroupNS string
CGroupsMode string
CGroupParent string
CIDFile string
@@ -93,6 +93,7 @@ type ContainerCLIOpts struct {
TmpFS []string
TTY bool
Timezone string
+ Umask string
UIDMap []string
Ulimit []string
User string
diff --git a/cmd/podman/common/createparse.go b/cmd/podman/common/createparse.go
index 7f10d578e..059f9050f 100644
--- a/cmd/podman/common/createparse.go
+++ b/cmd/podman/common/createparse.go
@@ -1,7 +1,7 @@
package common
import (
- "github.com/containers/libpod/v2/pkg/util"
+ "github.com/containers/podman/v2/pkg/util"
"github.com/pkg/errors"
)
diff --git a/cmd/podman/common/default.go b/cmd/podman/common/default.go
index b4fd2f604..af64e7162 100644
--- a/cmd/podman/common/default.go
+++ b/cmd/podman/common/default.go
@@ -1,7 +1,7 @@
package common
import (
- "github.com/containers/libpod/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/registry"
)
var (
diff --git a/cmd/podman/common/netflags.go b/cmd/podman/common/netflags.go
index 5c83a3c9c..1b8297c36 100644
--- a/cmd/podman/common/netflags.go
+++ b/cmd/podman/common/netflags.go
@@ -2,11 +2,12 @@ package common
import (
"net"
+ "strings"
- "github.com/containers/libpod/v2/cmd/podman/parse"
- "github.com/containers/libpod/v2/libpod/define"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/specgen"
+ "github.com/containers/podman/v2/cmd/podman/parse"
+ "github.com/containers/podman/v2/libpod/define"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/specgen"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
@@ -164,11 +165,18 @@ func NetFlagsToNetOptions(cmd *cobra.Command) (*entities.NetOptions, error) {
return nil, err
}
+ parts := strings.SplitN(network, ":", 2)
+
ns, cniNets, err := specgen.ParseNetworkNamespace(network)
if err != nil {
return nil, err
}
+ if len(parts) > 1 {
+ opts.NetworkOptions = make(map[string][]string)
+ opts.NetworkOptions[parts[0]] = strings.Split(parts[1], ",")
+ cniNets = nil
+ }
opts.Network = ns
opts.CNINetworks = cniNets
}
diff --git a/cmd/podman/common/specgen.go b/cmd/podman/common/specgen.go
index 8a265cedf..0b6897d3a 100644
--- a/cmd/podman/common/specgen.go
+++ b/cmd/podman/common/specgen.go
@@ -8,14 +8,14 @@ import (
"time"
"github.com/containers/image/v5/manifest"
- "github.com/containers/libpod/v2/cmd/podman/parse"
- "github.com/containers/libpod/v2/libpod/define"
- ann "github.com/containers/libpod/v2/pkg/annotations"
- envLib "github.com/containers/libpod/v2/pkg/env"
- ns "github.com/containers/libpod/v2/pkg/namespaces"
- "github.com/containers/libpod/v2/pkg/specgen"
- systemdGen "github.com/containers/libpod/v2/pkg/systemd/generate"
- "github.com/containers/libpod/v2/pkg/util"
+ "github.com/containers/podman/v2/cmd/podman/parse"
+ "github.com/containers/podman/v2/libpod/define"
+ ann "github.com/containers/podman/v2/pkg/annotations"
+ envLib "github.com/containers/podman/v2/pkg/env"
+ ns "github.com/containers/podman/v2/pkg/namespaces"
+ "github.com/containers/podman/v2/pkg/specgen"
+ systemdGen "github.com/containers/podman/v2/pkg/systemd/generate"
+ "github.com/containers/podman/v2/pkg/util"
"github.com/docker/go-units"
"github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
@@ -186,6 +186,46 @@ func getMemoryLimits(s *specgen.SpecGenerator, c *ContainerCLIOpts) (*specs.Linu
return memory, nil
}
+func setNamespaces(s *specgen.SpecGenerator, c *ContainerCLIOpts) error {
+ var err error
+
+ if c.PID != "" {
+ s.PidNS, err = specgen.ParseNamespace(c.PID)
+ if err != nil {
+ return err
+ }
+ }
+ if c.IPC != "" {
+ s.IpcNS, err = specgen.ParseNamespace(c.IPC)
+ if err != nil {
+ return err
+ }
+ }
+ if c.UTS != "" {
+ s.UtsNS, err = specgen.ParseNamespace(c.UTS)
+ if err != nil {
+ return err
+ }
+ }
+ if c.CgroupNS != "" {
+ s.CgroupNS, err = specgen.ParseNamespace(c.CgroupNS)
+ if err != nil {
+ return err
+ }
+ }
+ // userns must be treated differently
+ if c.UserNS != "" {
+ s.UserNS, err = specgen.ParseUserNamespace(c.UserNS)
+ if err != nil {
+ return err
+ }
+ }
+ if c.Net != nil {
+ s.NetNS = c.Net.Network
+ }
+ return nil
+}
+
func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string) error {
var (
err error
@@ -252,28 +292,8 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string
}
s.Expose = expose
- for k, v := range map[string]*specgen.Namespace{
- c.IPC: &s.IpcNS,
- c.PID: &s.PidNS,
- c.UTS: &s.UtsNS,
- c.CGroupsNS: &s.CgroupNS,
- } {
- if k != "" {
- *v, err = specgen.ParseNamespace(k)
- if err != nil {
- return err
- }
- }
- }
- // userns must be treated differently
- if c.UserNS != "" {
- s.UserNS, err = specgen.ParseUserNamespace(c.UserNS)
- if err != nil {
- return err
- }
- }
- if c.Net != nil {
- s.NetNS = c.Net.Network
+ if err := setNamespaces(s, c); err != nil {
+ return err
}
if sig := c.StopSignal; len(sig) > 0 {
@@ -417,6 +437,7 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string
s.DNSOptions = c.Net.DNSOptions
s.StaticIP = c.Net.StaticIP
s.StaticMAC = c.Net.StaticMAC
+ s.NetworkOptions = c.Net.NetworkOptions
s.UseImageHosts = c.Net.NoHosts
s.ImageVolumeMode = c.ImageVolume
@@ -511,10 +532,8 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string
s.ContainerSecurityConfig.SelinuxOpts = append(s.ContainerSecurityConfig.SelinuxOpts, con[1])
s.Annotations[define.InspectAnnotationLabel] = strings.Join(s.ContainerSecurityConfig.SelinuxOpts, ",label=")
case "apparmor":
- if !c.Privileged {
- s.ContainerSecurityConfig.ApparmorProfile = con[1]
- s.Annotations[define.InspectAnnotationApparmor] = con[1]
- }
+ s.ContainerSecurityConfig.ApparmorProfile = con[1]
+ s.Annotations[define.InspectAnnotationApparmor] = con[1]
case "seccomp":
s.SeccompProfilePath = con[1]
s.Annotations[define.InspectAnnotationSeccomp] = con[1]
@@ -530,12 +549,13 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string
// Only add read-only tmpfs mounts in case that we are read-only and the
// read-only tmpfs flag has been set.
- mounts, volumes, err := parseVolumes(c.Volume, c.Mount, c.TmpFS, c.ReadOnlyTmpFS && c.ReadOnly)
+ mounts, volumes, overlayVolumes, err := parseVolumes(c.Volume, c.Mount, c.TmpFS, c.ReadOnlyTmpFS && c.ReadOnly)
if err != nil {
return err
}
s.Mounts = mounts
s.Volumes = volumes
+ s.OverlayVolumes = overlayVolumes
for _, dev := range c.Devices {
s.Devices = append(s.Devices, specs.LinuxDevice{Path: dev})
@@ -611,6 +631,7 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string
s.Remove = c.Rm
s.StopTimeout = &c.StopTimeout
s.Timezone = c.Timezone
+ s.Umask = c.Umask
return nil
}
diff --git a/cmd/podman/common/util.go b/cmd/podman/common/util.go
index e21e349d9..41432c6f0 100644
--- a/cmd/podman/common/util.go
+++ b/cmd/podman/common/util.go
@@ -6,7 +6,7 @@ import (
"strconv"
"strings"
- "github.com/containers/libpod/v2/pkg/specgen"
+ "github.com/containers/podman/v2/pkg/specgen"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
diff --git a/cmd/podman/common/volumes.go b/cmd/podman/common/volumes.go
index b201786f0..3b8f7ec6e 100644
--- a/cmd/podman/common/volumes.go
+++ b/cmd/podman/common/volumes.go
@@ -6,8 +6,8 @@ import (
"strings"
"github.com/containers/buildah/pkg/parse"
- "github.com/containers/libpod/v2/pkg/specgen"
- "github.com/containers/libpod/v2/pkg/util"
+ "github.com/containers/podman/v2/pkg/specgen"
+ "github.com/containers/podman/v2/pkg/util"
spec "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
@@ -34,43 +34,43 @@ var (
// Does not handle image volumes, init, and --volumes-from flags.
// Can also add tmpfs mounts from read-only tmpfs.
// TODO: handle options parsing/processing via containers/storage/pkg/mount
-func parseVolumes(volumeFlag, mountFlag, tmpfsFlag []string, addReadOnlyTmpfs bool) ([]spec.Mount, []*specgen.NamedVolume, error) {
+func parseVolumes(volumeFlag, mountFlag, tmpfsFlag []string, addReadOnlyTmpfs bool) ([]spec.Mount, []*specgen.NamedVolume, []*specgen.OverlayVolume, error) {
// Get mounts from the --mounts flag.
unifiedMounts, unifiedVolumes, err := getMounts(mountFlag)
if err != nil {
- return nil, nil, err
+ return nil, nil, nil, err
}
// Next --volumes flag.
- volumeMounts, volumeVolumes, err := getVolumeMounts(volumeFlag)
+ volumeMounts, volumeVolumes, overlayVolumes, err := getVolumeMounts(volumeFlag)
if err != nil {
- return nil, nil, err
+ return nil, nil, nil, err
}
// Next --tmpfs flag.
tmpfsMounts, err := getTmpfsMounts(tmpfsFlag)
if err != nil {
- return nil, nil, err
+ return nil, nil, nil, err
}
// Unify mounts from --mount, --volume, --tmpfs.
// Start with --volume.
for dest, mount := range volumeMounts {
if _, ok := unifiedMounts[dest]; ok {
- return nil, nil, errors.Wrapf(errDuplicateDest, dest)
+ return nil, nil, nil, errors.Wrapf(errDuplicateDest, dest)
}
unifiedMounts[dest] = mount
}
for dest, volume := range volumeVolumes {
if _, ok := unifiedVolumes[dest]; ok {
- return nil, nil, errors.Wrapf(errDuplicateDest, dest)
+ return nil, nil, nil, errors.Wrapf(errDuplicateDest, dest)
}
unifiedVolumes[dest] = volume
}
// Now --tmpfs
for dest, tmpfs := range tmpfsMounts {
if _, ok := unifiedMounts[dest]; ok {
- return nil, nil, errors.Wrapf(errDuplicateDest, dest)
+ return nil, nil, nil, errors.Wrapf(errDuplicateDest, dest)
}
unifiedMounts[dest] = tmpfs
}
@@ -101,15 +101,29 @@ func parseVolumes(volumeFlag, mountFlag, tmpfsFlag []string, addReadOnlyTmpfs bo
}
}
- // Check for conflicts between named volumes and mounts
+ // Check for conflicts between named volumes, overlay volumes, and mounts
for dest := range unifiedMounts {
if _, ok := unifiedVolumes[dest]; ok {
- return nil, nil, errors.Wrapf(errDuplicateDest, "conflict at mount destination %v", dest)
+ return nil, nil, nil, errors.Wrapf(errDuplicateDest, "conflict at mount destination %v", dest)
+ }
+ if _, ok := overlayVolumes[dest]; ok {
+ return nil, nil, nil, errors.Wrapf(errDuplicateDest, "conflict at mount destination %v", dest)
}
}
for dest := range unifiedVolumes {
if _, ok := unifiedMounts[dest]; ok {
- return nil, nil, errors.Wrapf(errDuplicateDest, "conflict at mount destination %v", dest)
+ return nil, nil, nil, errors.Wrapf(errDuplicateDest, "conflict at mount destination %v", dest)
+ }
+ if _, ok := overlayVolumes[dest]; ok {
+ return nil, nil, nil, errors.Wrapf(errDuplicateDest, "conflict at mount destination %v", dest)
+ }
+ }
+ for dest := range overlayVolumes {
+ if _, ok := unifiedMounts[dest]; ok {
+ return nil, nil, nil, errors.Wrapf(errDuplicateDest, "conflict at mount destination %v", dest)
+ }
+ if _, ok := unifiedVolumes[dest]; ok {
+ return nil, nil, nil, errors.Wrapf(errDuplicateDest, "conflict at mount destination %v", dest)
}
}
@@ -119,7 +133,7 @@ func parseVolumes(volumeFlag, mountFlag, tmpfsFlag []string, addReadOnlyTmpfs bo
if mount.Type == TypeBind {
absSrc, err := filepath.Abs(mount.Source)
if err != nil {
- return nil, nil, errors.Wrapf(err, "error getting absolute path of %s", mount.Source)
+ return nil, nil, nil, errors.Wrapf(err, "error getting absolute path of %s", mount.Source)
}
mount.Source = absSrc
}
@@ -129,8 +143,12 @@ func parseVolumes(volumeFlag, mountFlag, tmpfsFlag []string, addReadOnlyTmpfs bo
for _, volume := range unifiedVolumes {
finalVolumes = append(finalVolumes, volume)
}
+ finalOverlayVolume := make([]*specgen.OverlayVolume, 0)
+ for _, volume := range overlayVolumes {
+ finalOverlayVolume = append(finalOverlayVolume, volume)
+ }
- return finalMounts, finalVolumes, nil
+ return finalMounts, finalVolumes, finalOverlayVolume, nil
}
// getMounts takes user-provided input from the --mount flag and creates OCI
@@ -465,9 +483,10 @@ func getNamedVolume(args []string) (*specgen.NamedVolume, error) {
return newVolume, nil
}
-func getVolumeMounts(volumeFlag []string) (map[string]spec.Mount, map[string]*specgen.NamedVolume, error) {
+func getVolumeMounts(volumeFlag []string) (map[string]spec.Mount, map[string]*specgen.NamedVolume, map[string]*specgen.OverlayVolume, error) {
mounts := make(map[string]spec.Mount)
volumes := make(map[string]*specgen.NamedVolume)
+ overlayVolumes := make(map[string]*specgen.OverlayVolume)
volumeFormatErr := errors.Errorf("incorrect volume format, should be [host-dir:]ctr-dir[:option]")
@@ -481,7 +500,7 @@ func getVolumeMounts(volumeFlag []string) (map[string]spec.Mount, map[string]*sp
splitVol := strings.Split(vol, ":")
if len(splitVol) > 3 {
- return nil, nil, errors.Wrapf(volumeFormatErr, vol)
+ return nil, nil, nil, errors.Wrapf(volumeFormatErr, vol)
}
src = splitVol[0]
@@ -496,34 +515,54 @@ func getVolumeMounts(volumeFlag []string) (map[string]spec.Mount, map[string]*sp
}
if len(splitVol) > 2 {
if options, err = parse.ValidateVolumeOpts(strings.Split(splitVol[2], ",")); err != nil {
- return nil, nil, err
+ return nil, nil, nil, err
}
}
// Do not check source dir for anonymous volumes
if len(splitVol) > 1 {
if err := parse.ValidateVolumeHostDir(src); err != nil {
- return nil, nil, err
+ return nil, nil, nil, err
}
}
if err := parse.ValidateVolumeCtrDir(dest); err != nil {
- return nil, nil, err
+ return nil, nil, nil, err
}
cleanDest := filepath.Clean(dest)
if strings.HasPrefix(src, "/") || strings.HasPrefix(src, ".") {
// This is not a named volume
- newMount := spec.Mount{
- Destination: cleanDest,
- Type: string(TypeBind),
- Source: src,
- Options: options,
+ overlayFlag := false
+ for _, o := range options {
+ if o == "O" {
+ overlayFlag = true
+ if len(options) > 1 {
+ return nil, nil, nil, errors.New("can't use 'O' with other options")
+ }
+ }
}
- if _, ok := mounts[newMount.Destination]; ok {
- return nil, nil, errors.Wrapf(errDuplicateDest, newMount.Destination)
+ if overlayFlag {
+ // This is a overlay volume
+ newOverlayVol := new(specgen.OverlayVolume)
+ newOverlayVol.Destination = cleanDest
+ newOverlayVol.Source = src
+ if _, ok := overlayVolumes[newOverlayVol.Destination]; ok {
+ return nil, nil, nil, errors.Wrapf(errDuplicateDest, newOverlayVol.Destination)
+ }
+ overlayVolumes[newOverlayVol.Destination] = newOverlayVol
+ } else {
+ newMount := spec.Mount{
+ Destination: cleanDest,
+ Type: string(TypeBind),
+ Source: src,
+ Options: options,
+ }
+ if _, ok := mounts[newMount.Destination]; ok {
+ return nil, nil, nil, errors.Wrapf(errDuplicateDest, newMount.Destination)
+ }
+ mounts[newMount.Destination] = newMount
}
- mounts[newMount.Destination] = newMount
} else {
// This is a named volume
newNamedVol := new(specgen.NamedVolume)
@@ -532,7 +571,7 @@ func getVolumeMounts(volumeFlag []string) (map[string]spec.Mount, map[string]*sp
newNamedVol.Options = options
if _, ok := volumes[newNamedVol.Dest]; ok {
- return nil, nil, errors.Wrapf(errDuplicateDest, newNamedVol.Dest)
+ return nil, nil, nil, errors.Wrapf(errDuplicateDest, newNamedVol.Dest)
}
volumes[newNamedVol.Dest] = newNamedVol
}
@@ -540,7 +579,7 @@ func getVolumeMounts(volumeFlag []string) (map[string]spec.Mount, map[string]*sp
logrus.Debugf("User mount %s:%s options %v", src, dest, options)
}
- return mounts, volumes, nil
+ return mounts, volumes, overlayVolumes, nil
}
// GetTmpfsMounts creates spec.Mount structs for user-requested tmpfs mounts
diff --git a/cmd/podman/containers/attach.go b/cmd/podman/containers/attach.go
index eca9e0787..cfe7df441 100644
--- a/cmd/podman/containers/attach.go
+++ b/cmd/podman/containers/attach.go
@@ -3,9 +3,9 @@ package containers
import (
"os"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
diff --git a/cmd/podman/containers/checkpoint.go b/cmd/podman/containers/checkpoint.go
index 683437000..284393dc0 100644
--- a/cmd/podman/containers/checkpoint.go
+++ b/cmd/podman/containers/checkpoint.go
@@ -4,11 +4,11 @@ import (
"context"
"fmt"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/utils"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/rootless"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/utils"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/rootless"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/containers/cleanup.go b/cmd/podman/containers/cleanup.go
index 5dea77b7a..7913f5a10 100644
--- a/cmd/podman/containers/cleanup.go
+++ b/cmd/podman/containers/cleanup.go
@@ -3,10 +3,10 @@ package containers
import (
"fmt"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/utils"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/utils"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
diff --git a/cmd/podman/containers/commit.go b/cmd/podman/containers/commit.go
index d2aa32e45..31294c66d 100644
--- a/cmd/podman/containers/commit.go
+++ b/cmd/podman/containers/commit.go
@@ -7,8 +7,8 @@ import (
"os"
"strings"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
diff --git a/cmd/podman/containers/container.go b/cmd/podman/containers/container.go
index f51baa936..b79b7db03 100644
--- a/cmd/podman/containers/container.go
+++ b/cmd/podman/containers/container.go
@@ -1,10 +1,10 @@
package containers
import (
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/util"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/util"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/containers/cp.go b/cmd/podman/containers/cp.go
index 290128761..28a18e83e 100644
--- a/cmd/podman/containers/cp.go
+++ b/cmd/podman/containers/cp.go
@@ -1,10 +1,10 @@
package containers
import (
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/cgroups"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/rootless"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/cgroups"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/rootless"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
diff --git a/cmd/podman/containers/create.go b/cmd/podman/containers/create.go
index 9c9edb14f..dd77dc9d7 100644
--- a/cmd/podman/containers/create.go
+++ b/cmd/podman/containers/create.go
@@ -10,13 +10,13 @@ import (
"github.com/containers/common/pkg/config"
"github.com/containers/image/v5/storage"
"github.com/containers/image/v5/transports/alltransports"
- "github.com/containers/libpod/v2/cmd/podman/common"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/libpod/define"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/errorhandling"
- "github.com/containers/libpod/v2/pkg/specgen"
- "github.com/containers/libpod/v2/pkg/util"
+ "github.com/containers/podman/v2/cmd/podman/common"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/libpod/define"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/errorhandling"
+ "github.com/containers/podman/v2/pkg/specgen"
+ "github.com/containers/podman/v2/pkg/util"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
@@ -195,7 +195,7 @@ func createInit(c *cobra.Command) error {
cliVals.IPC = c.Flag("ipc").Value.String()
cliVals.UTS = c.Flag("uts").Value.String()
cliVals.PID = c.Flag("pid").Value.String()
- cliVals.CGroupsNS = c.Flag("cgroupns").Value.String()
+ cliVals.CgroupNS = c.Flag("cgroupns").Value.String()
if c.Flag("entrypoint").Changed {
val := c.Flag("entrypoint").Value.String()
cliVals.Entrypoint = &val
@@ -221,7 +221,7 @@ func createInit(c *cobra.Command) error {
}
// Docker-compatibility: the "-h" flag for run/create is reserved for
- // the hostname (see https://github.com/containers/libpod/issues/1367).
+ // the hostname (see https://github.com/containers/podman/issues/1367).
return nil
}
diff --git a/cmd/podman/containers/diff.go b/cmd/podman/containers/diff.go
index f39b22ede..227c13f4c 100644
--- a/cmd/podman/containers/diff.go
+++ b/cmd/podman/containers/diff.go
@@ -1,10 +1,10 @@
package containers
import (
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/report"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/report"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/containers/exec.go b/cmd/podman/containers/exec.go
index e0fc740b5..da450054f 100644
--- a/cmd/podman/containers/exec.go
+++ b/cmd/podman/containers/exec.go
@@ -5,11 +5,11 @@ import (
"fmt"
"os"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/libpod/define"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- envLib "github.com/containers/libpod/v2/pkg/env"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/libpod/define"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ envLib "github.com/containers/podman/v2/pkg/env"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
diff --git a/cmd/podman/containers/exists.go b/cmd/podman/containers/exists.go
index 1f7c05122..283f6df18 100644
--- a/cmd/podman/containers/exists.go
+++ b/cmd/podman/containers/exists.go
@@ -3,8 +3,8 @@ package containers
import (
"context"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/containers/export.go b/cmd/podman/containers/export.go
index 4a9b7f38b..1a59b7fff 100644
--- a/cmd/podman/containers/export.go
+++ b/cmd/podman/containers/export.go
@@ -4,9 +4,9 @@ import (
"context"
"os"
- "github.com/containers/libpod/v2/cmd/podman/parse"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/parse"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
diff --git a/cmd/podman/containers/init.go b/cmd/podman/containers/init.go
index 98f69fa4b..5a826bc59 100644
--- a/cmd/podman/containers/init.go
+++ b/cmd/podman/containers/init.go
@@ -3,10 +3,10 @@ package containers
import (
"fmt"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/utils"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/utils"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)
diff --git a/cmd/podman/containers/inspect.go b/cmd/podman/containers/inspect.go
index c0d1d5c79..1c208b513 100644
--- a/cmd/podman/containers/inspect.go
+++ b/cmd/podman/containers/inspect.go
@@ -1,10 +1,10 @@
package containers
import (
- "github.com/containers/libpod/v2/cmd/podman/inspect"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/inspect"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/containers/kill.go b/cmd/podman/containers/kill.go
index da60fcf52..a4d536098 100644
--- a/cmd/podman/containers/kill.go
+++ b/cmd/podman/containers/kill.go
@@ -5,11 +5,11 @@ import (
"errors"
"fmt"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/utils"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/signal"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/utils"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/signal"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)
diff --git a/cmd/podman/containers/list.go b/cmd/podman/containers/list.go
index 2d107d51d..daf03a51b 100644
--- a/cmd/podman/containers/list.go
+++ b/cmd/podman/containers/list.go
@@ -1,9 +1,9 @@
package containers
import (
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/containers/logs.go b/cmd/podman/containers/logs.go
index 966998877..21c00505f 100644
--- a/cmd/podman/containers/logs.go
+++ b/cmd/podman/containers/logs.go
@@ -3,10 +3,10 @@ package containers
import (
"os"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/util"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/util"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
diff --git a/cmd/podman/containers/mount.go b/cmd/podman/containers/mount.go
index 186c4df16..1c358f4a2 100644
--- a/cmd/podman/containers/mount.go
+++ b/cmd/podman/containers/mount.go
@@ -6,10 +6,11 @@ import (
"text/tabwriter"
"text/template"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/utils"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/utils"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)
@@ -31,7 +32,8 @@ var (
return validate.CheckAllLatestAndCIDFile(cmd, args, true, false)
},
Annotations: map[string]string{
- registry.ParentNSRequired: "",
+ registry.UnshareNSRequired: "",
+ registry.ParentNSRequired: "",
},
}
@@ -51,7 +53,7 @@ var (
func mountFlags(flags *pflag.FlagSet) {
flags.BoolVarP(&mountOpts.All, "all", "a", false, "Mount all containers")
- flags.StringVar(&mountOpts.Format, "format", "", "Change the output format to Go template")
+ flags.StringVar(&mountOpts.Format, "format", "", "Print the mounted containers in specified format (json)")
flags.BoolVar(&mountOpts.NoTruncate, "notruncate", false, "Do not truncate output")
}
@@ -90,14 +92,21 @@ func mount(_ *cobra.Command, args []string) error {
}
return errs.PrintErrors()
}
- if mountOpts.Format == "json" {
+
+ switch mountOpts.Format {
+ case "json":
return printJSON(reports)
+ case "":
+ // do nothing
+ default:
+ return errors.Errorf("unknown --format argument: %s", mountOpts.Format)
}
+
mrs := make([]mountReporter, 0, len(reports))
for _, r := range reports {
mrs = append(mrs, mountReporter{r})
}
- row := "{{.ID}} {{.Path}}"
+ row := "{{.ID}} {{.Path}}\n"
format := "{{range . }}" + row + "{{end}}"
tmpl, err := template.New("mounts").Parse(format)
if err != nil {
diff --git a/cmd/podman/containers/pause.go b/cmd/podman/containers/pause.go
index 33d6ff06f..c2218bc44 100644
--- a/cmd/podman/containers/pause.go
+++ b/cmd/podman/containers/pause.go
@@ -4,10 +4,10 @@ import (
"context"
"fmt"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/utils"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/rootless"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/utils"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/rootless"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
diff --git a/cmd/podman/containers/port.go b/cmd/podman/containers/port.go
index 7c0d8f5f6..347f06bba 100644
--- a/cmd/podman/containers/port.go
+++ b/cmd/podman/containers/port.go
@@ -5,9 +5,9 @@ import (
"strconv"
"strings"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/cri-o/ocicni/pkg/ocicni"
"github.com/pkg/errors"
"github.com/spf13/cobra"
diff --git a/cmd/podman/containers/prune.go b/cmd/podman/containers/prune.go
index 65e023b39..90dea2b45 100644
--- a/cmd/podman/containers/prune.go
+++ b/cmd/podman/containers/prune.go
@@ -8,9 +8,9 @@ import (
"os"
"strings"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/utils"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/utils"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/containers/ps.go b/cmd/podman/containers/ps.go
index 7c84cbae1..34fa4fab5 100644
--- a/cmd/podman/containers/ps.go
+++ b/cmd/podman/containers/ps.go
@@ -12,9 +12,9 @@ import (
tm "github.com/buger/goterm"
"github.com/containers/buildah/pkg/formats"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/cri-o/ocicni/pkg/ocicni"
"github.com/docker/go-units"
"github.com/pkg/errors"
diff --git a/cmd/podman/containers/restart.go b/cmd/podman/containers/restart.go
index 393b003a9..d02097f0e 100644
--- a/cmd/podman/containers/restart.go
+++ b/cmd/podman/containers/restart.go
@@ -4,11 +4,11 @@ import (
"context"
"fmt"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/utils"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/libpod/define"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/utils"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/libpod/define"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
diff --git a/cmd/podman/containers/restore.go b/cmd/podman/containers/restore.go
index e9e0ad6fc..413bcbc87 100644
--- a/cmd/podman/containers/restore.go
+++ b/cmd/podman/containers/restore.go
@@ -4,11 +4,11 @@ import (
"context"
"fmt"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/utils"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/rootless"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/utils"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/rootless"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/containers/rm.go b/cmd/podman/containers/rm.go
index 427e1e72c..8d0c7920f 100644
--- a/cmd/podman/containers/rm.go
+++ b/cmd/podman/containers/rm.go
@@ -5,11 +5,11 @@ import (
"fmt"
"strings"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/utils"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/libpod/define"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/utils"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/libpod/define"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
diff --git a/cmd/podman/containers/run.go b/cmd/podman/containers/run.go
index 17a5c6d97..646c52645 100644
--- a/cmd/podman/containers/run.go
+++ b/cmd/podman/containers/run.go
@@ -6,14 +6,14 @@ import (
"strconv"
"strings"
- "github.com/containers/libpod/v2/cmd/podman/common"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/libpod/define"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/errorhandling"
- "github.com/containers/libpod/v2/pkg/rootless"
- "github.com/containers/libpod/v2/pkg/specgen"
- "github.com/containers/libpod/v2/pkg/util"
+ "github.com/containers/podman/v2/cmd/podman/common"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/libpod/define"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/errorhandling"
+ "github.com/containers/podman/v2/pkg/rootless"
+ "github.com/containers/podman/v2/pkg/specgen"
+ "github.com/containers/podman/v2/pkg/util"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
diff --git a/cmd/podman/containers/runlabel.go b/cmd/podman/containers/runlabel.go
index c962f6c3b..81eec2a42 100644
--- a/cmd/podman/containers/runlabel.go
+++ b/cmd/podman/containers/runlabel.go
@@ -6,8 +6,8 @@ import (
"github.com/containers/common/pkg/auth"
"github.com/containers/image/v5/types"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
diff --git a/cmd/podman/containers/start.go b/cmd/podman/containers/start.go
index 21f22b986..05fdfc780 100644
--- a/cmd/podman/containers/start.go
+++ b/cmd/podman/containers/start.go
@@ -4,11 +4,11 @@ import (
"fmt"
"os"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/utils"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/libpod/define"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/utils"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/libpod/define"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
@@ -99,7 +99,7 @@ func start(cmd *cobra.Command, args []string) error {
}
for _, r := range responses {
- if r.Err == nil {
+ if r.Err == nil && !startOptions.Attach {
fmt.Println(r.RawInput)
} else {
errs = append(errs, r.Err)
diff --git a/cmd/podman/containers/stats.go b/cmd/podman/containers/stats.go
index 86674cfc9..2b4c46647 100644
--- a/cmd/podman/containers/stats.go
+++ b/cmd/podman/containers/stats.go
@@ -9,13 +9,13 @@ import (
"text/template"
tm "github.com/buger/goterm"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/libpod/define"
- "github.com/containers/libpod/v2/pkg/cgroups"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/rootless"
- "github.com/containers/libpod/v2/utils"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/libpod/define"
+ "github.com/containers/podman/v2/pkg/cgroups"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/rootless"
+ "github.com/containers/podman/v2/utils"
"github.com/docker/go-units"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
diff --git a/cmd/podman/containers/stop.go b/cmd/podman/containers/stop.go
index 7959918a8..1c0a5efe4 100644
--- a/cmd/podman/containers/stop.go
+++ b/cmd/podman/containers/stop.go
@@ -4,10 +4,10 @@ import (
"context"
"fmt"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/utils"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/utils"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)
diff --git a/cmd/podman/containers/top.go b/cmd/podman/containers/top.go
index c3f411be7..f2632d57a 100644
--- a/cmd/podman/containers/top.go
+++ b/cmd/podman/containers/top.go
@@ -7,10 +7,10 @@ import (
"strings"
"text/tabwriter"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/util"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/util"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
diff --git a/cmd/podman/containers/unmount.go b/cmd/podman/containers/unmount.go
index c40c2be7e..424d4cedc 100644
--- a/cmd/podman/containers/unmount.go
+++ b/cmd/podman/containers/unmount.go
@@ -3,10 +3,10 @@ package containers
import (
"fmt"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/utils"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/utils"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)
@@ -18,31 +18,32 @@ var (
An unmount can be forced with the --force flag.
`
- umountCommand = &cobra.Command{
- Use: "umount [flags] CONTAINER [CONTAINER...]",
- Aliases: []string{"unmount"},
+ unmountCommand = &cobra.Command{
+ Use: "unmount [flags] CONTAINER [CONTAINER...]",
+ Aliases: []string{"umount"},
Short: "Unmounts working container's root filesystem",
Long: description,
RunE: unmount,
Args: func(cmd *cobra.Command, args []string) error {
return validate.CheckAllLatestAndCIDFile(cmd, args, false, false)
},
- Example: `podman umount ctrID
- podman umount ctrID1 ctrID2 ctrID3
- podman umount --all`,
+ Example: `podman unmount ctrID
+ podman unmount ctrID1 ctrID2 ctrID3
+ podman unmount --all`,
}
containerUnmountCommand = &cobra.Command{
- Use: umountCommand.Use,
- Short: umountCommand.Short,
- Long: umountCommand.Long,
- RunE: umountCommand.RunE,
+ Use: unmountCommand.Use,
+ Short: unmountCommand.Short,
+ Aliases: unmountCommand.Aliases,
+ Long: unmountCommand.Long,
+ RunE: unmountCommand.RunE,
Args: func(cmd *cobra.Command, args []string) error {
return validate.CheckAllLatestAndCIDFile(cmd, args, false, false)
},
- Example: `podman container umount ctrID
- podman container umount ctrID1 ctrID2 ctrID3
- podman container umount --all`,
+ Example: `podman container unmount ctrID
+ podman container unmount ctrID1 ctrID2 ctrID3
+ podman container unmount --all`,
}
)
@@ -50,25 +51,25 @@ var (
unmountOpts entities.ContainerUnmountOptions
)
-func umountFlags(flags *pflag.FlagSet) {
- flags.BoolVarP(&unmountOpts.All, "all", "a", false, "Umount all of the currently mounted containers")
- flags.BoolVarP(&unmountOpts.Force, "force", "f", false, "Force the complete umount all of the currently mounted containers")
+func unmountFlags(flags *pflag.FlagSet) {
+ flags.BoolVarP(&unmountOpts.All, "all", "a", false, "Unmount all of the currently mounted containers")
+ flags.BoolVarP(&unmountOpts.Force, "force", "f", false, "Force the complete unmount of the specified mounted containers")
}
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
Mode: []entities.EngineMode{entities.ABIMode},
- Command: umountCommand,
+ Command: unmountCommand,
})
- umountFlags(umountCommand.Flags())
- validate.AddLatestFlag(umountCommand, &unmountOpts.Latest)
+ unmountFlags(unmountCommand.Flags())
+ validate.AddLatestFlag(unmountCommand, &unmountOpts.Latest)
registry.Commands = append(registry.Commands, registry.CliCommand{
Mode: []entities.EngineMode{entities.ABIMode},
Command: containerUnmountCommand,
Parent: containerCmd,
})
- umountFlags(containerUnmountCommand.Flags())
+ unmountFlags(containerUnmountCommand.Flags())
validate.AddLatestFlag(containerUnmountCommand, &unmountOpts.Latest)
}
diff --git a/cmd/podman/containers/unpause.go b/cmd/podman/containers/unpause.go
index 9d4437afb..50113669c 100644
--- a/cmd/podman/containers/unpause.go
+++ b/cmd/podman/containers/unpause.go
@@ -4,10 +4,10 @@ import (
"context"
"fmt"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/utils"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/rootless"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/utils"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/rootless"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
diff --git a/cmd/podman/containers/wait.go b/cmd/podman/containers/wait.go
index c30bfe405..74ee6073a 100644
--- a/cmd/podman/containers/wait.go
+++ b/cmd/podman/containers/wait.go
@@ -5,11 +5,11 @@ import (
"fmt"
"time"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/utils"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/libpod/define"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/utils"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/libpod/define"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
diff --git a/cmd/podman/diff.go b/cmd/podman/diff.go
index cdd908cf1..51a04bf46 100644
--- a/cmd/podman/diff.go
+++ b/cmd/podman/diff.go
@@ -3,11 +3,11 @@ package main
import (
"fmt"
- "github.com/containers/libpod/v2/cmd/podman/containers"
- "github.com/containers/libpod/v2/cmd/podman/images"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/containers"
+ "github.com/containers/podman/v2/cmd/podman/images"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/early_init_linux.go b/cmd/podman/early_init_linux.go
new file mode 100644
index 000000000..e2893ff69
--- /dev/null
+++ b/cmd/podman/early_init_linux.go
@@ -0,0 +1,39 @@
+package main
+
+import (
+ "fmt"
+ "os"
+ "syscall"
+
+ "github.com/containers/podman/v2/libpod/define"
+ "github.com/pkg/errors"
+)
+
+func setRLimits() error {
+ rlimits := new(syscall.Rlimit)
+ rlimits.Cur = define.RLimitDefaultValue
+ rlimits.Max = define.RLimitDefaultValue
+ if err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, rlimits); err != nil {
+ if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, rlimits); err != nil {
+ return errors.Wrapf(err, "error getting rlimits")
+ }
+ rlimits.Cur = rlimits.Max
+ if err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, rlimits); err != nil {
+ return errors.Wrapf(err, "error setting new rlimits")
+ }
+ }
+ return nil
+}
+
+func setUMask() {
+ // Be sure we can create directories with 0755 mode.
+ syscall.Umask(0022)
+}
+
+func earlyInitHook() {
+ if err := setRLimits(); err != nil {
+ fmt.Fprint(os.Stderr, "Failed to set rlimits: "+err.Error())
+ }
+
+ setUMask()
+}
diff --git a/cmd/podman/early_init_unsupported.go b/cmd/podman/early_init_unsupported.go
new file mode 100644
index 000000000..4e748559f
--- /dev/null
+++ b/cmd/podman/early_init_unsupported.go
@@ -0,0 +1,6 @@
+// +build !linux
+
+package main
+
+func earlyInitHook() {
+}
diff --git a/cmd/podman/generate/generate.go b/cmd/podman/generate/generate.go
index d85d93347..fa2739b20 100644
--- a/cmd/podman/generate/generate.go
+++ b/cmd/podman/generate/generate.go
@@ -1,10 +1,10 @@
package pods
import (
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/util"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/util"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/generate/kube.go b/cmd/podman/generate/kube.go
index 56ddfbe97..2f63ba590 100644
--- a/cmd/podman/generate/kube.go
+++ b/cmd/podman/generate/kube.go
@@ -5,9 +5,9 @@ import (
"io/ioutil"
"os"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/utils"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/utils"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/generate/systemd.go b/cmd/podman/generate/systemd.go
index 5f319f21b..851a104bc 100644
--- a/cmd/podman/generate/systemd.go
+++ b/cmd/podman/generate/systemd.go
@@ -3,9 +3,9 @@ package pods
import (
"fmt"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/utils"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/utils"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/healthcheck/healthcheck.go b/cmd/podman/healthcheck/healthcheck.go
index fdf40e872..683836ed6 100644
--- a/cmd/podman/healthcheck/healthcheck.go
+++ b/cmd/podman/healthcheck/healthcheck.go
@@ -1,9 +1,9 @@
package healthcheck
import (
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/healthcheck/run.go b/cmd/podman/healthcheck/run.go
index d6a429080..6d7f0b548 100644
--- a/cmd/podman/healthcheck/run.go
+++ b/cmd/podman/healthcheck/run.go
@@ -4,8 +4,8 @@ import (
"context"
"fmt"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/images/build.go b/cmd/podman/images/build.go
index 3ea74b4af..400f960cc 100644
--- a/cmd/podman/images/build.go
+++ b/cmd/podman/images/build.go
@@ -10,9 +10,9 @@ import (
buildahCLI "github.com/containers/buildah/pkg/cli"
"github.com/containers/buildah/pkg/parse"
"github.com/containers/common/pkg/config"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/utils"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/utils"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/docker/go-units"
"github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
@@ -138,36 +138,9 @@ func build(cmd *cobra.Command, args []string) error {
return errors.New("cannot specify --squash, --squash-all and --layers options together")
}
- contextDir, containerFiles, err := extractContextAndFiles(args, buildOpts.File)
- if err != nil {
- return err
- }
-
- ie, err := registry.NewImageEngine(cmd, args)
- if err != nil {
- return err
- }
-
- apiBuildOpts, err := buildFlagsWrapperToOptions(cmd, contextDir, &buildOpts)
- if err != nil {
- return err
- }
-
- _, err = ie.Build(registry.GetContext(), containerFiles, *apiBuildOpts)
- return err
-}
-
-// extractContextAndFiles parses args and files to extract a context directory
-// and {Container,Docker}files.
-//
-// TODO: this was copied and altered from the v1 client which in turn was
-// copied and altered from the Buildah code. Ideally, all of this code should
-// be cleanly consolidated into a package that is shared between Buildah and
-// Podman.
-func extractContextAndFiles(args, files []string) (string, []string, error) {
// Extract container files from the CLI (i.e., --file/-f) first.
var containerFiles []string
- for _, f := range files {
+ for _, f := range buildOpts.File {
if f == "-" {
containerFiles = append(containerFiles, "/dev/stdin")
} else {
@@ -181,7 +154,7 @@ func extractContextAndFiles(args, files []string) (string, []string, error) {
// The context directory could be a URL. Try to handle that.
tempDir, subDir, err := imagebuildah.TempDirForURL("", "buildah", args[0])
if err != nil {
- return "", nil, errors.Wrapf(err, "error prepping temporary context directory")
+ return errors.Wrapf(err, "error prepping temporary context directory")
}
if tempDir != "" {
// We had to download it to a temporary directory.
@@ -196,7 +169,7 @@ func extractContextAndFiles(args, files []string) (string, []string, error) {
// Nope, it was local. Use it as is.
absDir, err := filepath.Abs(args[0])
if err != nil {
- return "", nil, errors.Wrapf(err, "error determining path to directory %q", args[0])
+ return errors.Wrapf(err, "error determining path to directory %q", args[0])
}
contextDir = absDir
}
@@ -212,7 +185,7 @@ func extractContextAndFiles(args, files []string) (string, []string, error) {
}
absFile, err := filepath.Abs(containerFiles[i])
if err != nil {
- return "", nil, errors.Wrapf(err, "error determining path to file %q", containerFiles[i])
+ return errors.Wrapf(err, "error determining path to file %q", containerFiles[i])
}
contextDir = filepath.Dir(absFile)
break
@@ -220,10 +193,10 @@ func extractContextAndFiles(args, files []string) (string, []string, error) {
}
if contextDir == "" {
- return "", nil, errors.Errorf("no context directory and no Containerfile specified")
+ return errors.Errorf("no context directory and no Containerfile specified")
}
if !utils.IsDir(contextDir) {
- return "", nil, errors.Errorf("context must be a directory: %q", contextDir)
+ return errors.Errorf("context must be a directory: %q", contextDir)
}
if len(containerFiles) == 0 {
if utils.FileExists(filepath.Join(contextDir, "Containerfile")) {
@@ -233,7 +206,18 @@ func extractContextAndFiles(args, files []string) (string, []string, error) {
}
}
- return contextDir, containerFiles, nil
+ ie, err := registry.NewImageEngine(cmd, args)
+ if err != nil {
+ return err
+ }
+
+ apiBuildOpts, err := buildFlagsWrapperToOptions(cmd, contextDir, &buildOpts)
+ if err != nil {
+ return err
+ }
+
+ _, err = ie.Build(registry.GetContext(), containerFiles, *apiBuildOpts)
+ return err
}
// buildFlagsWrapperToOptions converts the local build flags to the build options used
diff --git a/cmd/podman/images/diff.go b/cmd/podman/images/diff.go
index 10a1c06ec..26147345e 100644
--- a/cmd/podman/images/diff.go
+++ b/cmd/podman/images/diff.go
@@ -1,9 +1,9 @@
package images
import (
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/report"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/report"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
diff --git a/cmd/podman/images/exists.go b/cmd/podman/images/exists.go
index 7e05ea8f7..31bdc791e 100644
--- a/cmd/podman/images/exists.go
+++ b/cmd/podman/images/exists.go
@@ -1,8 +1,8 @@
package images
import (
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/images/history.go b/cmd/podman/images/history.go
index 3732e6e03..ef5b4be26 100644
--- a/cmd/podman/images/history.go
+++ b/cmd/podman/images/history.go
@@ -10,8 +10,8 @@ import (
"time"
"unicode"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/docker/go-units"
"github.com/pkg/errors"
"github.com/spf13/cobra"
diff --git a/cmd/podman/images/image.go b/cmd/podman/images/image.go
index 89badd035..abf6bf736 100644
--- a/cmd/podman/images/image.go
+++ b/cmd/podman/images/image.go
@@ -1,9 +1,9 @@
package images
import (
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/images/images.go b/cmd/podman/images/images.go
index 0a77946c7..14ea01047 100644
--- a/cmd/podman/images/images.go
+++ b/cmd/podman/images/images.go
@@ -3,8 +3,8 @@ package images
import (
"strings"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/images/import.go b/cmd/podman/images/import.go
index 6b4b4f6b6..e605ddfc6 100644
--- a/cmd/podman/images/import.go
+++ b/cmd/podman/images/import.go
@@ -4,9 +4,9 @@ import (
"context"
"fmt"
- "github.com/containers/libpod/v2/cmd/podman/parse"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/parse"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/hashicorp/go-multierror"
"github.com/pkg/errors"
"github.com/spf13/cobra"
diff --git a/cmd/podman/images/inspect.go b/cmd/podman/images/inspect.go
index c6ef503bf..065dfaed2 100644
--- a/cmd/podman/images/inspect.go
+++ b/cmd/podman/images/inspect.go
@@ -1,9 +1,9 @@
package images
import (
- "github.com/containers/libpod/v2/cmd/podman/inspect"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/inspect"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/images/list.go b/cmd/podman/images/list.go
index 37ff491c3..4552901f7 100644
--- a/cmd/podman/images/list.go
+++ b/cmd/podman/images/list.go
@@ -1,7 +1,6 @@
package images
import (
- "errors"
"fmt"
"os"
"sort"
@@ -11,9 +10,11 @@ import (
"time"
"unicode"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/image/v5/docker/reference"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/docker/go-units"
+ "github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)
@@ -98,7 +99,10 @@ func images(cmd *cobra.Command, args []string) error {
return err
}
- imgs := sortImages(summaries)
+ imgs, err := sortImages(summaries)
+ if err != nil {
+ return err
+ }
switch {
case listFlag.quiet:
return writeID(imgs)
@@ -170,14 +174,18 @@ func writeTemplate(imgs []imageReporter) error {
return tmpl.Execute(w, imgs)
}
-func sortImages(imageS []*entities.ImageSummary) []imageReporter {
+func sortImages(imageS []*entities.ImageSummary) ([]imageReporter, error) {
imgs := make([]imageReporter, 0, len(imageS))
+ var err error
for _, e := range imageS {
var h imageReporter
if len(e.RepoTags) > 0 {
for _, tag := range e.RepoTags {
h.ImageSummary = *e
- h.Repository, h.Tag = tokenRepoTag(tag)
+ h.Repository, h.Tag, err = tokenRepoTag(tag)
+ if err != nil {
+ return nil, errors.Wrapf(err, "error parsing repository tag %q:", tag)
+ }
imgs = append(imgs, h)
}
} else {
@@ -189,23 +197,32 @@ func sortImages(imageS []*entities.ImageSummary) []imageReporter {
}
sort.Slice(imgs, sortFunc(listFlag.sort, imgs))
- return imgs
+ return imgs, err
}
-func tokenRepoTag(tag string) (string, string) {
- tokens := strings.Split(tag, ":")
- switch len(tokens) {
- case 0:
- return tag, ""
- case 1:
- return tokens[0], ""
- case 2:
- return tokens[0], tokens[1]
- case 3:
- return tokens[0] + ":" + tokens[1], tokens[2]
- default:
- return "<N/A>", ""
+func tokenRepoTag(ref string) (string, string, error) {
+
+ if ref == "<none>:<none>" {
+ return "<none>", "<none>", nil
+ }
+
+ repo, err := reference.Parse(ref)
+ if err != nil {
+ return "", "", err
+ }
+
+ named, ok := repo.(reference.Named)
+ if !ok {
+ return ref, "", nil
}
+
+ tagged, ok := repo.(reference.Tagged)
+ if !ok {
+ return named.Name(), "", nil
+ }
+
+ return named.Name(), tagged.Tag(), nil
+
}
func sortFunc(key string, data []imageReporter) func(i, j int) bool {
diff --git a/cmd/podman/images/load.go b/cmd/podman/images/load.go
index df7baae22..cc8e71814 100644
--- a/cmd/podman/images/load.go
+++ b/cmd/podman/images/load.go
@@ -9,10 +9,10 @@ import (
"strings"
"github.com/containers/image/v5/docker/reference"
- "github.com/containers/libpod/v2/cmd/podman/parse"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/util"
+ "github.com/containers/podman/v2/cmd/podman/parse"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/util"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
diff --git a/cmd/podman/images/mount.go b/cmd/podman/images/mount.go
new file mode 100644
index 000000000..fac06e324
--- /dev/null
+++ b/cmd/podman/images/mount.go
@@ -0,0 +1,139 @@
+package images
+
+import (
+ "fmt"
+ "os"
+ "text/tabwriter"
+ "text/template"
+
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/utils"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/pkg/errors"
+ "github.com/spf13/cobra"
+ "github.com/spf13/pflag"
+)
+
+var (
+ mountDescription = `podman image mount
+ Lists all mounted images mount points if no images is specified
+
+ podman image mount IMAGE-NAME-OR-ID
+ Mounts the specified image and prints the mountpoint
+`
+
+ mountCommand = &cobra.Command{
+ Use: "mount [flags] [IMAGE...]",
+ Short: "Mount an images's root filesystem",
+ Long: mountDescription,
+ RunE: mount,
+ Example: `podman image mount imgID
+ podman image mount imgID1 imgID2 imgID3
+ podman image mount
+ podman image mount --all`,
+ Annotations: map[string]string{
+ registry.UnshareNSRequired: "",
+ registry.ParentNSRequired: "",
+ },
+ }
+)
+
+var (
+ mountOpts entities.ImageMountOptions
+)
+
+func mountFlags(flags *pflag.FlagSet) {
+ flags.BoolVarP(&mountOpts.All, "all", "a", false, "Mount all images")
+ flags.StringVar(&mountOpts.Format, "format", "", "Print the mounted images in specified format (json)")
+}
+
+func init() {
+ registry.Commands = append(registry.Commands, registry.CliCommand{
+ Mode: []entities.EngineMode{entities.ABIMode},
+ Command: mountCommand,
+ Parent: imageCmd,
+ })
+ mountFlags(mountCommand.Flags())
+}
+
+func mount(_ *cobra.Command, args []string) error {
+ var (
+ errs utils.OutputErrors
+ )
+ if len(args) > 0 && mountOpts.All {
+ return errors.New("when using the --all switch, you may not pass any image names or IDs")
+ }
+ reports, err := registry.ImageEngine().Mount(registry.GetContext(), args, mountOpts)
+ if err != nil {
+ return err
+ }
+ if len(args) > 0 || mountOpts.All {
+ for _, r := range reports {
+ if r.Err == nil {
+ fmt.Println(r.Path)
+ continue
+ }
+ errs = append(errs, r.Err)
+ }
+ return errs.PrintErrors()
+ }
+
+ switch mountOpts.Format {
+ case "json":
+ return printJSON(reports)
+ case "":
+ // do nothing
+ default:
+ return errors.Errorf("unknown --format argument: %s", mountOpts.Format)
+ }
+
+ mrs := make([]mountReporter, 0, len(reports))
+ for _, r := range reports {
+ mrs = append(mrs, mountReporter{r})
+ }
+ row := "{{.ID}} {{.Path}}\n"
+ format := "{{range . }}" + row + "{{end}}"
+ tmpl, err := template.New("mounts").Parse(format)
+ if err != nil {
+ return err
+ }
+ w := tabwriter.NewWriter(os.Stdout, 8, 2, 2, ' ', 0)
+ defer w.Flush()
+ return tmpl.Execute(w, mrs)
+}
+
+func printJSON(reports []*entities.ImageMountReport) error {
+ type jreport struct {
+ ID string `json:"id"`
+ Names []string
+ Repositories []string
+ Mountpoint string `json:"mountpoint"`
+ }
+ jreports := make([]jreport, 0, len(reports))
+
+ for _, r := range reports {
+ jreports = append(jreports, jreport{
+ ID: r.Id,
+ Names: []string{r.Name},
+ Repositories: r.Repositories,
+ Mountpoint: r.Path,
+ })
+ }
+ b, err := json.MarshalIndent(jreports, "", " ")
+ if err != nil {
+ return err
+ }
+ fmt.Println(string(b))
+ return nil
+}
+
+type mountReporter struct {
+ *entities.ImageMountReport
+}
+
+func (m mountReporter) ID() string {
+ if len(m.Repositories) > 0 {
+ return m.Repositories[0]
+ }
+ return m.Id
+}
diff --git a/cmd/podman/images/prune.go b/cmd/podman/images/prune.go
index 002453907..8dc203ead 100644
--- a/cmd/podman/images/prune.go
+++ b/cmd/podman/images/prune.go
@@ -6,10 +6,10 @@ import (
"os"
"strings"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/utils"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/utils"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/images/pull.go b/cmd/podman/images/pull.go
index 83bb186df..4deaecbf5 100644
--- a/cmd/podman/images/pull.go
+++ b/cmd/podman/images/pull.go
@@ -6,9 +6,9 @@ import (
"github.com/containers/common/pkg/auth"
"github.com/containers/image/v5/types"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/util"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/util"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
@@ -82,6 +82,7 @@ func pullFlags(flags *pflag.FlagSet) {
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.Bool("disable-content-trust", false, "This is a Docker specific option and is a NOOP")
flags.BoolVarP(&pullOptions.Quiet, "quiet", "q", false, "Suppress output information when pulling images")
flags.StringVar(&pullOptions.SignaturePolicy, "signature-policy", "", "`Pathname` of signature policy file (not usually used)")
flags.BoolVar(&pullOptions.TLSVerifyCLI, "tls-verify", true, "Require HTTPS and verify certificates when contacting registries")
diff --git a/cmd/podman/images/push.go b/cmd/podman/images/push.go
index 4eeed13d4..2943cccc9 100644
--- a/cmd/podman/images/push.go
+++ b/cmd/podman/images/push.go
@@ -5,9 +5,9 @@ import (
"github.com/containers/common/pkg/auth"
"github.com/containers/image/v5/types"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/util"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/util"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
@@ -79,6 +79,7 @@ func pushFlags(flags *pflag.FlagSet) {
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.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.Bool("disable-content-trust", false, "This is a Docker specific option and is a NOOP")
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")
flags.BoolVar(&pushOptions.RemoveSignatures, "remove-signatures", false, "Discard any pre-existing signatures in the image")
diff --git a/cmd/podman/images/rm.go b/cmd/podman/images/rm.go
index c14c256fc..f6e52a49e 100644
--- a/cmd/podman/images/rm.go
+++ b/cmd/podman/images/rm.go
@@ -3,9 +3,9 @@ package images
import (
"fmt"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/errorhandling"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/errorhandling"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
diff --git a/cmd/podman/images/rmi.go b/cmd/podman/images/rmi.go
index 8e70906ce..520847890 100644
--- a/cmd/podman/images/rmi.go
+++ b/cmd/podman/images/rmi.go
@@ -3,8 +3,8 @@ package images
import (
"strings"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/images/save.go b/cmd/podman/images/save.go
index 097cb3a40..024045b9d 100644
--- a/cmd/podman/images/save.go
+++ b/cmd/podman/images/save.go
@@ -5,12 +5,12 @@ import (
"os"
"strings"
- "github.com/containers/libpod/v2/libpod/define"
+ "github.com/containers/podman/v2/libpod/define"
- "github.com/containers/libpod/v2/cmd/podman/parse"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/util"
+ "github.com/containers/podman/v2/cmd/podman/parse"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/util"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
diff --git a/cmd/podman/images/search.go b/cmd/podman/images/search.go
index f1a2cda96..c7f16a838 100644
--- a/cmd/podman/images/search.go
+++ b/cmd/podman/images/search.go
@@ -8,9 +8,9 @@ import (
"github.com/containers/buildah/pkg/formats"
"github.com/containers/common/pkg/auth"
"github.com/containers/image/v5/types"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/util/camelcase"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/util/camelcase"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
diff --git a/cmd/podman/images/sign.go b/cmd/podman/images/sign.go
index 9115342ed..e331a64df 100644
--- a/cmd/podman/images/sign.go
+++ b/cmd/podman/images/sign.go
@@ -3,8 +3,8 @@ package images
import (
"os"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/images/tag.go b/cmd/podman/images/tag.go
index 1bb956288..be7f84588 100644
--- a/cmd/podman/images/tag.go
+++ b/cmd/podman/images/tag.go
@@ -1,8 +1,8 @@
package images
import (
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/images/tree.go b/cmd/podman/images/tree.go
index f229cfa29..0b79c2a4b 100644
--- a/cmd/podman/images/tree.go
+++ b/cmd/podman/images/tree.go
@@ -3,8 +3,8 @@ package images
import (
"fmt"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/images/trust.go b/cmd/podman/images/trust.go
index 9fc8c1f07..842540110 100644
--- a/cmd/podman/images/trust.go
+++ b/cmd/podman/images/trust.go
@@ -1,9 +1,9 @@
package images
import (
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/images/trust_set.go b/cmd/podman/images/trust_set.go
index 71b77f961..878ffeea6 100644
--- a/cmd/podman/images/trust_set.go
+++ b/cmd/podman/images/trust_set.go
@@ -1,10 +1,10 @@
package images
import (
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/libpod/image"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/util"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/libpod/image"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/util"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/images/trust_show.go b/cmd/podman/images/trust_show.go
index 79a583caa..d968f6d80 100644
--- a/cmd/podman/images/trust_show.go
+++ b/cmd/podman/images/trust_show.go
@@ -6,8 +6,8 @@ import (
"text/tabwriter"
"text/template"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/images/unmount.go b/cmd/podman/images/unmount.go
new file mode 100644
index 000000000..f7f6cf8e5
--- /dev/null
+++ b/cmd/podman/images/unmount.go
@@ -0,0 +1,71 @@
+package images
+
+import (
+ "fmt"
+
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/utils"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/pkg/errors"
+ "github.com/spf13/cobra"
+ "github.com/spf13/pflag"
+)
+
+var (
+ description = `Image storage increments a mount counter each time an image is mounted.
+
+ When an image is unmounted, the mount counter is decremented. The image's root filesystem is physically unmounted only when the mount counter reaches zero indicating no other processes are using the mount.
+
+ An unmount can be forced with the --force flag.
+`
+ unmountCommand = &cobra.Command{
+ Use: "unmount [flags] IMAGE [IMAGE...]",
+ Aliases: []string{"umount"},
+ Short: "Unmount an image's root filesystem",
+ Long: description,
+ RunE: unmount,
+ Example: `podman unmount imgID
+ podman unmount imgID1 imgID2 imgID3
+ podman unmount --all`,
+ }
+)
+
+var (
+ unmountOpts entities.ImageUnmountOptions
+)
+
+func unmountFlags(flags *pflag.FlagSet) {
+ flags.BoolVarP(&unmountOpts.All, "all", "a", false, "Unmount all of the currently mounted images")
+ flags.BoolVarP(&unmountOpts.Force, "force", "f", false, "Force the complete unmount of the specified mounted images")
+}
+
+func init() {
+ registry.Commands = append(registry.Commands, registry.CliCommand{
+ Mode: []entities.EngineMode{entities.ABIMode},
+ Parent: imageCmd,
+ Command: unmountCommand,
+ })
+ unmountFlags(unmountCommand.Flags())
+}
+
+func unmount(cmd *cobra.Command, args []string) error {
+ var errs utils.OutputErrors
+ if len(args) < 1 && !unmountOpts.All {
+ return errors.New("image name or ID must be specified")
+ }
+ if len(args) > 0 && unmountOpts.All {
+ return errors.New("when using the --all switch, you may not pass any image names or IDs")
+ }
+ reports, err := registry.ImageEngine().Unmount(registry.GetContext(), args, unmountOpts)
+ if err != nil {
+ return err
+ }
+ for _, r := range reports {
+ if r.Err == nil {
+ fmt.Println(r.Id)
+ } else {
+ errs = append(errs, r.Err)
+ }
+ }
+ return errs.PrintErrors()
+}
diff --git a/cmd/podman/images/untag.go b/cmd/podman/images/untag.go
index 39804b2bc..da749c8a5 100644
--- a/cmd/podman/images/untag.go
+++ b/cmd/podman/images/untag.go
@@ -1,8 +1,8 @@
package images
import (
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/inspect.go b/cmd/podman/inspect.go
index 42f6ccea3..85050a497 100644
--- a/cmd/podman/inspect.go
+++ b/cmd/podman/inspect.go
@@ -1,9 +1,9 @@
package main
import (
- "github.com/containers/libpod/v2/cmd/podman/inspect"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/inspect"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/inspect/inspect.go b/cmd/podman/inspect/inspect.go
index 6fcca597b..13c6544bb 100644
--- a/cmd/podman/inspect/inspect.go
+++ b/cmd/podman/inspect/inspect.go
@@ -7,9 +7,9 @@ import (
"strings"
"github.com/containers/buildah/pkg/formats"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
diff --git a/cmd/podman/login.go b/cmd/podman/login.go
index 2239d61b9..1556b0dcf 100644
--- a/cmd/podman/login.go
+++ b/cmd/podman/login.go
@@ -6,9 +6,9 @@ import (
"github.com/containers/common/pkg/auth"
"github.com/containers/image/v5/types"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/registries"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/registries"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/logout.go b/cmd/podman/logout.go
index b38f92749..1c6fdfb2a 100644
--- a/cmd/podman/logout.go
+++ b/cmd/podman/logout.go
@@ -5,9 +5,9 @@ import (
"github.com/containers/common/pkg/auth"
"github.com/containers/image/v5/types"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/registries"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/registries"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/main.go b/cmd/podman/main.go
index 5f740a006..007a8716c 100644
--- a/cmd/podman/main.go
+++ b/cmd/podman/main.go
@@ -4,19 +4,20 @@ import (
"fmt"
"os"
- _ "github.com/containers/libpod/v2/cmd/podman/containers"
- _ "github.com/containers/libpod/v2/cmd/podman/generate"
- _ "github.com/containers/libpod/v2/cmd/podman/healthcheck"
- _ "github.com/containers/libpod/v2/cmd/podman/images"
- _ "github.com/containers/libpod/v2/cmd/podman/manifest"
- _ "github.com/containers/libpod/v2/cmd/podman/networks"
- _ "github.com/containers/libpod/v2/cmd/podman/play"
- _ "github.com/containers/libpod/v2/cmd/podman/pods"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- _ "github.com/containers/libpod/v2/cmd/podman/system"
- _ "github.com/containers/libpod/v2/cmd/podman/volumes"
- "github.com/containers/libpod/v2/pkg/rootless"
- "github.com/containers/libpod/v2/pkg/terminal"
+ _ "github.com/containers/podman/v2/cmd/podman/containers"
+ _ "github.com/containers/podman/v2/cmd/podman/generate"
+ _ "github.com/containers/podman/v2/cmd/podman/healthcheck"
+ _ "github.com/containers/podman/v2/cmd/podman/images"
+ _ "github.com/containers/podman/v2/cmd/podman/manifest"
+ _ "github.com/containers/podman/v2/cmd/podman/networks"
+ _ "github.com/containers/podman/v2/cmd/podman/play"
+ _ "github.com/containers/podman/v2/cmd/podman/pods"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ _ "github.com/containers/podman/v2/cmd/podman/system"
+ _ "github.com/containers/podman/v2/cmd/podman/system/connection"
+ _ "github.com/containers/podman/v2/cmd/podman/volumes"
+ "github.com/containers/podman/v2/pkg/rootless"
+ "github.com/containers/podman/v2/pkg/terminal"
"github.com/containers/storage/pkg/reexec"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
@@ -39,13 +40,21 @@ func main() {
for _, m := range c.Mode {
if cfg.EngineMode == m {
// Command cannot be run rootless
- _, found := c.Command.Annotations[registry.ParentNSRequired]
- if rootless.IsRootless() && found {
- c.Command.RunE = func(cmd *cobra.Command, args []string) error {
- return fmt.Errorf("cannot run command %q in rootless mode", cmd.CommandPath())
+ _, found := c.Command.Annotations[registry.UnshareNSRequired]
+ if found {
+ if rootless.IsRootless() && found && os.Getuid() != 0 {
+ c.Command.RunE = func(cmd *cobra.Command, args []string) error {
+ return fmt.Errorf("cannot run command %q in rootless mode, must execute `podman unshare` first", cmd.CommandPath())
+ }
+ }
+ } else {
+ _, found = c.Command.Annotations[registry.ParentNSRequired]
+ if rootless.IsRootless() && found {
+ c.Command.RunE = func(cmd *cobra.Command, args []string) error {
+ return fmt.Errorf("cannot run command %q in rootless mode", cmd.CommandPath())
+ }
}
}
-
parent := rootCmd
if c.Parent != nil {
parent = c.Parent
diff --git a/cmd/podman/manifest/add.go b/cmd/podman/manifest/add.go
index a9947d805..ca633263d 100644
--- a/cmd/podman/manifest/add.go
+++ b/cmd/podman/manifest/add.go
@@ -4,8 +4,8 @@ import (
"context"
"fmt"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/manifest/annotate.go b/cmd/podman/manifest/annotate.go
index 779c33edc..1b720aa39 100644
--- a/cmd/podman/manifest/annotate.go
+++ b/cmd/podman/manifest/annotate.go
@@ -4,8 +4,8 @@ import (
"context"
"fmt"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/manifest/create.go b/cmd/podman/manifest/create.go
index a05cae7f6..b5352d24f 100644
--- a/cmd/podman/manifest/create.go
+++ b/cmd/podman/manifest/create.go
@@ -4,8 +4,8 @@ import (
"context"
"fmt"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/manifest/inspect.go b/cmd/podman/manifest/inspect.go
index 0ab8f7a7c..19396ceb3 100644
--- a/cmd/podman/manifest/inspect.go
+++ b/cmd/podman/manifest/inspect.go
@@ -4,8 +4,8 @@ import (
"context"
"fmt"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/manifest/manifest.go b/cmd/podman/manifest/manifest.go
index f992705c1..c3bcdc8c7 100644
--- a/cmd/podman/manifest/manifest.go
+++ b/cmd/podman/manifest/manifest.go
@@ -1,9 +1,9 @@
package manifest
import (
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/manifest/push.go b/cmd/podman/manifest/push.go
index d1eb37ae5..b43e4531a 100644
--- a/cmd/podman/manifest/push.go
+++ b/cmd/podman/manifest/push.go
@@ -3,9 +3,9 @@ package manifest
import (
"github.com/containers/common/pkg/auth"
"github.com/containers/image/v5/types"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/util"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/util"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/manifest/remove.go b/cmd/podman/manifest/remove.go
index a77cd04c7..677d45484 100644
--- a/cmd/podman/manifest/remove.go
+++ b/cmd/podman/manifest/remove.go
@@ -4,8 +4,8 @@ import (
"context"
"fmt"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/networks/create.go b/cmd/podman/networks/create.go
index f208fad7c..dabf6f0d2 100644
--- a/cmd/podman/networks/create.go
+++ b/cmd/podman/networks/create.go
@@ -4,10 +4,10 @@ import (
"fmt"
"net"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/libpod/define"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/network"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/libpod/define"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/network"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)
diff --git a/cmd/podman/networks/inspect.go b/cmd/podman/networks/inspect.go
index bf2c7a5e0..f00d6b63c 100644
--- a/cmd/podman/networks/inspect.go
+++ b/cmd/podman/networks/inspect.go
@@ -3,13 +3,13 @@ package network
import (
"encoding/json"
"fmt"
- "html/template"
"io"
"os"
"strings"
+ "text/template"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/networks/list.go b/cmd/podman/networks/list.go
index ad2ee98b1..3a2651cbc 100644
--- a/cmd/podman/networks/list.go
+++ b/cmd/podman/networks/list.go
@@ -3,15 +3,15 @@ package network
import (
"encoding/json"
"fmt"
- "html/template"
"os"
"strings"
"text/tabwriter"
+ "text/template"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/network"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/network"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)
diff --git a/cmd/podman/networks/network.go b/cmd/podman/networks/network.go
index 953e4678c..b5f9ef9fd 100644
--- a/cmd/podman/networks/network.go
+++ b/cmd/podman/networks/network.go
@@ -1,9 +1,9 @@
package network
import (
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/networks/rm.go b/cmd/podman/networks/rm.go
index 230da88a6..dfbb5d081 100644
--- a/cmd/podman/networks/rm.go
+++ b/cmd/podman/networks/rm.go
@@ -3,9 +3,9 @@ package network
import (
"fmt"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/utils"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/utils"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)
diff --git a/cmd/podman/play/kube.go b/cmd/podman/play/kube.go
index 9bd5c10db..54a6d0677 100644
--- a/cmd/podman/play/kube.go
+++ b/cmd/podman/play/kube.go
@@ -6,10 +6,10 @@ import (
"github.com/containers/common/pkg/auth"
"github.com/containers/image/v5/types"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/utils"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/util"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/utils"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/util"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/play/play.go b/cmd/podman/play/play.go
index eb8873595..607c99767 100644
--- a/cmd/podman/play/play.go
+++ b/cmd/podman/play/play.go
@@ -1,9 +1,9 @@
package pods
import (
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/pods/create.go b/cmd/podman/pods/create.go
index d57a2f2f7..603ddcaca 100644
--- a/cmd/podman/pods/create.go
+++ b/cmd/podman/pods/create.go
@@ -7,14 +7,14 @@ import (
"os"
"strings"
- "github.com/containers/libpod/v2/cmd/podman/common"
- "github.com/containers/libpod/v2/cmd/podman/parse"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/errorhandling"
- "github.com/containers/libpod/v2/pkg/specgen"
- "github.com/containers/libpod/v2/pkg/util"
+ "github.com/containers/podman/v2/cmd/podman/common"
+ "github.com/containers/podman/v2/cmd/podman/parse"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/errorhandling"
+ "github.com/containers/podman/v2/pkg/specgen"
+ "github.com/containers/podman/v2/pkg/util"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
diff --git a/cmd/podman/pods/exists.go b/cmd/podman/pods/exists.go
index 599b6abe2..cdaf2a707 100644
--- a/cmd/podman/pods/exists.go
+++ b/cmd/podman/pods/exists.go
@@ -3,8 +3,8 @@ package pods
import (
"context"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/pods/inspect.go b/cmd/podman/pods/inspect.go
index e21c7a74b..8f5aa6062 100644
--- a/cmd/podman/pods/inspect.go
+++ b/cmd/podman/pods/inspect.go
@@ -5,9 +5,9 @@ import (
"fmt"
"github.com/containers/buildah/pkg/formats"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/pods/kill.go b/cmd/podman/pods/kill.go
index 2f4930897..d666d7537 100644
--- a/cmd/podman/pods/kill.go
+++ b/cmd/podman/pods/kill.go
@@ -4,10 +4,10 @@ import (
"context"
"fmt"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/utils"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/utils"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/pods/pause.go b/cmd/podman/pods/pause.go
index f79d88973..591378983 100644
--- a/cmd/podman/pods/pause.go
+++ b/cmd/podman/pods/pause.go
@@ -4,10 +4,10 @@ import (
"context"
"fmt"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/utils"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/utils"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/pods/pod.go b/cmd/podman/pods/pod.go
index fff5ea615..12448a5f1 100644
--- a/cmd/podman/pods/pod.go
+++ b/cmd/podman/pods/pod.go
@@ -1,10 +1,10 @@
package pods
import (
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/util"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/util"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/pods/prune.go b/cmd/podman/pods/prune.go
index ee97e13f1..a7347ede5 100644
--- a/cmd/podman/pods/prune.go
+++ b/cmd/podman/pods/prune.go
@@ -7,9 +7,9 @@ import (
"os"
"strings"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/utils"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/utils"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/pods/ps.go b/cmd/podman/pods/ps.go
index 7a1221480..97e528c7c 100644
--- a/cmd/podman/pods/ps.go
+++ b/cmd/podman/pods/ps.go
@@ -11,9 +11,9 @@ import (
"text/template"
"time"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/docker/go-units"
"github.com/pkg/errors"
"github.com/spf13/cobra"
diff --git a/cmd/podman/pods/restart.go b/cmd/podman/pods/restart.go
index 77d9f62d4..11e8b4ebc 100644
--- a/cmd/podman/pods/restart.go
+++ b/cmd/podman/pods/restart.go
@@ -4,10 +4,10 @@ import (
"context"
"fmt"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/utils"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/utils"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/pods/rm.go b/cmd/podman/pods/rm.go
index 3e07b31e9..0bb35e1ca 100644
--- a/cmd/podman/pods/rm.go
+++ b/cmd/podman/pods/rm.go
@@ -4,11 +4,11 @@ import (
"context"
"fmt"
- "github.com/containers/libpod/v2/cmd/podman/common"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/utils"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/common"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/utils"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/pods/start.go b/cmd/podman/pods/start.go
index 586737fb2..e2ca3fd41 100644
--- a/cmd/podman/pods/start.go
+++ b/cmd/podman/pods/start.go
@@ -4,11 +4,11 @@ import (
"context"
"fmt"
- "github.com/containers/libpod/v2/cmd/podman/common"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/utils"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/common"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/utils"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/pods/stats.go b/cmd/podman/pods/stats.go
index 930a6d15c..1d916dbfa 100644
--- a/cmd/podman/pods/stats.go
+++ b/cmd/podman/pods/stats.go
@@ -12,10 +12,10 @@ import (
"github.com/buger/goterm"
"github.com/containers/buildah/pkg/formats"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/util/camelcase"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/util/camelcase"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/pods/stop.go b/cmd/podman/pods/stop.go
index 84190fd08..20c3f59bf 100644
--- a/cmd/podman/pods/stop.go
+++ b/cmd/podman/pods/stop.go
@@ -4,11 +4,11 @@ import (
"context"
"fmt"
- "github.com/containers/libpod/v2/cmd/podman/common"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/utils"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/common"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/utils"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/pods/top.go b/cmd/podman/pods/top.go
index 7e5f4e321..9877db404 100644
--- a/cmd/podman/pods/top.go
+++ b/cmd/podman/pods/top.go
@@ -7,10 +7,10 @@ import (
"strings"
"text/tabwriter"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/util"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/util"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/pods/unpause.go b/cmd/podman/pods/unpause.go
index f96f3481c..8474da57e 100644
--- a/cmd/podman/pods/unpause.go
+++ b/cmd/podman/pods/unpause.go
@@ -4,10 +4,10 @@ import (
"context"
"fmt"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/utils"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/utils"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/registry/config.go b/cmd/podman/registry/config.go
index 75e67b35d..0e29d5cd9 100644
--- a/cmd/podman/registry/config.go
+++ b/cmd/podman/registry/config.go
@@ -8,14 +8,15 @@ import (
"sync"
"github.com/containers/common/pkg/config"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/rootless"
- "github.com/containers/libpod/v2/pkg/util"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/rootless"
+ "github.com/containers/podman/v2/pkg/util"
"github.com/pkg/errors"
)
const (
- ParentNSRequired = "ParentNSRequired"
+ ParentNSRequired = "ParentNSRequired"
+ UnshareNSRequired = "UnshareNSRequired"
)
var (
@@ -33,7 +34,7 @@ func PodmanConfig() *entities.PodmanConfig {
func newPodmanConfig() {
if err := setXdgDirs(); err != nil {
- fmt.Fprintf(os.Stderr, err.Error())
+ fmt.Fprintln(os.Stderr, err.Error())
os.Exit(1)
}
@@ -44,11 +45,12 @@ func newPodmanConfig() {
case "linux":
// Some linux clients might only be compiled without ABI
// support (e.g., podman-remote).
- if abiSupport && !remoteOverride {
+ if abiSupport && !IsRemote() {
mode = entities.ABIMode
} else {
mode = entities.TunnelMode
}
+
default:
fmt.Fprintf(os.Stderr, "%s is not a supported OS", runtime.GOOS)
os.Exit(1)
@@ -70,7 +72,7 @@ func newPodmanConfig() {
// setXdgDirs ensures the XDG_RUNTIME_DIR env and XDG_CONFIG_HOME variables are set.
// containers/image uses XDG_RUNTIME_DIR to locate the auth file, XDG_CONFIG_HOME is
-// use for the libpod.conf configuration file.
+// use for the containers.conf configuration file.
func setXdgDirs() error {
if !rootless.IsRootless() {
return nil
diff --git a/cmd/podman/registry/registry.go b/cmd/podman/registry/registry.go
index d93b3e633..1e439613c 100644
--- a/cmd/podman/registry/registry.go
+++ b/cmd/podman/registry/registry.go
@@ -4,10 +4,10 @@ import (
"context"
"path/filepath"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/domain/infra"
- "github.com/containers/libpod/v2/pkg/rootless"
- "github.com/containers/libpod/v2/pkg/util"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/domain/infra"
+ "github.com/containers/podman/v2/pkg/rootless"
+ "github.com/containers/podman/v2/pkg/util"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/registry/remote.go b/cmd/podman/registry/remote.go
index 006a1b900..7dbdd3824 100644
--- a/cmd/podman/registry/remote.go
+++ b/cmd/podman/registry/remote.go
@@ -4,7 +4,7 @@ import (
"os"
"sync"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/report/diff.go b/cmd/podman/report/diff.go
index d044774a6..edd324bfe 100644
--- a/cmd/podman/report/diff.go
+++ b/cmd/podman/report/diff.go
@@ -4,7 +4,7 @@ import (
"fmt"
"os"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/containers/storage/pkg/archive"
"github.com/pkg/errors"
)
diff --git a/cmd/podman/report/report.go b/cmd/podman/report/report.go
index b8b1536fd..2c4f2e1fd 100644
--- a/cmd/podman/report/report.go
+++ b/cmd/podman/report/report.go
@@ -1,6 +1,6 @@
package report
-import "github.com/containers/libpod/v2/cmd/podman/registry"
+import "github.com/containers/podman/v2/cmd/podman/registry"
// Pull in configured json library
var json = registry.JSONLibrary()
diff --git a/cmd/podman/root.go b/cmd/podman/root.go
index eccca3d11..9e9011dc9 100644
--- a/cmd/podman/root.go
+++ b/cmd/podman/root.go
@@ -10,13 +10,13 @@ import (
"strings"
"github.com/containers/common/pkg/config"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/parallel"
- "github.com/containers/libpod/v2/pkg/rootless"
- "github.com/containers/libpod/v2/pkg/tracing"
- "github.com/containers/libpod/v2/version"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/parallel"
+ "github.com/containers/podman/v2/pkg/rootless"
+ "github.com/containers/podman/v2/pkg/tracing"
+ "github.com/containers/podman/v2/version"
"github.com/opentracing/opentracing-go"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
@@ -77,6 +77,7 @@ func init() {
cobra.OnInitialize(
loggingHook,
syslogHook,
+ earlyInitHook,
)
rootFlags(rootCmd, registry.PodmanConfig())
@@ -235,16 +236,12 @@ func loggingHook() {
func rootFlags(cmd *cobra.Command, opts *entities.PodmanConfig) {
cfg := opts.Config
+ uri, ident := resolveDestination()
lFlags := cmd.Flags()
- custom, _ := config.ReadCustomConfig()
- defaultURI := custom.Engine.RemoteURI
- if defaultURI == "" {
- defaultURI = registry.DefaultAPIAddress()
- }
lFlags.BoolVarP(&opts.Remote, "remote", "r", false, "Access remote Podman service (default false)")
- lFlags.StringVar(&opts.URI, "url", defaultURI, "URL to access Podman service (CONTAINER_HOST)")
- lFlags.StringVar(&opts.Identity, "identity", custom.Engine.RemoteIdentity, "path to SSH identity file, (CONTAINER_SSHKEY)")
+ lFlags.StringVar(&opts.URI, "url", uri, "URL to access Podman service (CONTAINER_HOST)")
+ lFlags.StringVar(&opts.Identity, "identity", ident, "path to SSH identity file, (CONTAINER_SSHKEY)")
pFlags := cmd.PersistentFlags()
pFlags.StringVar(&cfg.Engine.CgroupManager, "cgroup-manager", cfg.Engine.CgroupManager, "Cgroup manager to use (\"cgroupfs\"|\"systemd\")")
@@ -291,3 +288,24 @@ func rootFlags(cmd *cobra.Command, opts *entities.PodmanConfig) {
pFlags.BoolVar(&useSyslog, "syslog", false, "Output logging information to syslog as well as the console (default false)")
}
}
+
+func resolveDestination() (string, string) {
+ if uri, found := os.LookupEnv("CONTAINER_HOST"); found {
+ var ident string
+ if v, found := os.LookupEnv("CONTAINER_SSHKEY"); found {
+ ident = v
+ }
+ return uri, ident
+ }
+
+ cfg, err := config.ReadCustomConfig()
+ if err != nil {
+ return registry.DefaultAPIAddress(), ""
+ }
+
+ uri, ident, err := cfg.ActiveDestination()
+ if err != nil {
+ return registry.DefaultAPIAddress(), ""
+ }
+ return uri, ident
+}
diff --git a/cmd/podman/system/connection.go b/cmd/podman/system/connection.go
index 6a55d2d79..b6c18217e 100644
--- a/cmd/podman/system/connection.go
+++ b/cmd/podman/system/connection.go
@@ -1,208 +1,34 @@
package system
import (
- "bytes"
- "fmt"
- "net"
- "net/url"
- "os"
- "os/user"
- "regexp"
-
- "github.com/containers/common/pkg/config"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/libpod/define"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/terminal"
- "github.com/pkg/errors"
- "github.com/sirupsen/logrus"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
- "golang.org/x/crypto/ssh"
- "golang.org/x/crypto/ssh/agent"
)
-const schemaPattern = "^[A-Za-z][A-Za-z0-9+.-]*:"
-
var (
- // Skip creating engines since this command will obtain connection information to engine
+ // Skip creating engines since this command will obtain connection information to said engines
noOp = func(cmd *cobra.Command, args []string) error {
return nil
}
- connectionCmd = &cobra.Command{
- Use: "connection [flags] DESTINATION",
- Args: cobra.ExactArgs(1),
- Long: `Store ssh destination information in podman configuration.
- "destination" is of the form [user@]hostname or
- an URI of the form ssh://[user@]hostname[:port]
-`,
- Short: "Record remote ssh destination",
- PersistentPreRunE: noOp,
- PersistentPostRunE: noOp,
- TraverseChildren: false,
- RunE: connection,
- Example: `podman system connection server.fubar.com
- podman system connection --identity ~/.ssh/dev_rsa ssh://root@server.fubar.com:2222
- podman system connection --identity ~/.ssh/dev_rsa --port 22 root@server.fubar.com`,
- }
- cOpts = struct {
- Identity string
- Port int
- UDSPath string
- }{}
+ ConnectionCmd = &cobra.Command{
+ Use: "connection",
+ Short: "Manage remote ssh destinations",
+ Long: `Manage ssh destination information in podman configuration`,
+ DisableFlagsInUseLine: true,
+ PersistentPreRunE: noOp,
+ RunE: validate.SubCommandExists,
+ PersistentPostRunE: noOp,
+ TraverseChildren: false,
+ }
)
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
- Command: connectionCmd,
+ Command: ConnectionCmd,
Parent: systemCmd,
})
-
- flags := connectionCmd.Flags()
- flags.IntVarP(&cOpts.Port, "port", "p", 22, "port number for destination")
- flags.StringVar(&cOpts.UDSPath, "socket-path", "", "path to podman socket on remote host. (default '/run/podman/podman.sock' or '/run/user/{uid}/podman/podman.sock)")
-}
-
-func connection(cmd *cobra.Command, args []string) error {
- // Default to ssh: schema if none given
- dest := []byte(args[0])
- if match, err := regexp.Match(schemaPattern, dest); err != nil {
- return errors.Wrapf(err, "internal regex error %q", schemaPattern)
- } else if !match {
- dest = append([]byte("ssh://"), dest...)
- }
-
- uri, err := url.Parse(string(dest))
- if err != nil {
- return errors.Wrapf(err, "failed to parse %q", string(dest))
- }
-
- if uri.User.Username() == "" {
- if uri.User, err = getUserInfo(uri); err != nil {
- return err
- }
- }
-
- if cmd.Flag("socket-path").Changed {
- uri.Path = cmd.Flag("socket-path").Value.String()
- }
-
- if cmd.Flag("port").Changed {
- uri.Host = net.JoinHostPort(uri.Hostname(), cmd.Flag("port").Value.String())
- }
-
- if uri.Port() == "" {
- uri.Host = net.JoinHostPort(uri.Hostname(), cmd.Flag("port").DefValue)
- }
-
- if uri.Path == "" {
- if uri.Path, err = getUDS(cmd, uri); err != nil {
- return errors.Wrapf(err, "failed to connect to %q", uri.String())
- }
- }
-
- custom, err := config.ReadCustomConfig()
- if err != nil {
- return err
- }
-
- if cmd.Flag("identity").Changed {
- custom.Engine.RemoteIdentity = cOpts.Identity
- }
-
- custom.Engine.RemoteURI = uri.String()
- return custom.Write()
-}
-
-func getUserInfo(uri *url.URL) (*url.Userinfo, error) {
- var (
- usr *user.User
- err error
- )
- if u, found := os.LookupEnv("_CONTAINERS_ROOTLESS_UID"); found {
- usr, err = user.LookupId(u)
- if err != nil {
- return nil, errors.Wrapf(err, "failed to find user %q", u)
- }
- } else {
- usr, err = user.Current()
- if err != nil {
- return nil, errors.Wrapf(err, "failed to obtain current user")
- }
- }
-
- pw, set := uri.User.Password()
- if set {
- return url.UserPassword(usr.Username, pw), nil
- }
- return url.User(usr.Username), nil
-}
-
-func getUDS(cmd *cobra.Command, uri *url.URL) (string, error) {
- var authMethods []ssh.AuthMethod
- passwd, set := uri.User.Password()
- if set {
- authMethods = append(authMethods, ssh.Password(passwd))
- }
-
- ident := cmd.Flag("identity")
- if ident.Changed {
- auth, err := terminal.PublicKey(ident.Value.String(), []byte(passwd))
- if err != nil {
- return "", errors.Wrapf(err, "Failed to read identity %q", ident.Value.String())
- }
- authMethods = append(authMethods, auth)
- }
-
- if sock, found := os.LookupEnv("SSH_AUTH_SOCK"); found {
- logrus.Debugf("Found SSH_AUTH_SOCK %q, ssh-agent signer enabled", sock)
-
- c, err := net.Dial("unix", sock)
- if err != nil {
- return "", err
- }
- a := agent.NewClient(c)
- authMethods = append(authMethods, ssh.PublicKeysCallback(a.Signers))
- }
-
- config := &ssh.ClientConfig{
- User: uri.User.Username(),
- Auth: authMethods,
- HostKeyCallback: ssh.InsecureIgnoreHostKey(),
- }
- dial, err := ssh.Dial("tcp", uri.Host, config)
- if err != nil {
- return "", errors.Wrapf(err, "failed to connect to %q", uri.Host)
- }
- defer dial.Close()
-
- session, err := dial.NewSession()
- if err != nil {
- return "", errors.Wrapf(err, "failed to create new ssh session on %q", uri.Host)
- }
- defer session.Close()
-
- // Override podman binary for testing etc
- podman := "podman"
- if v, found := os.LookupEnv("PODMAN_BINARY"); found {
- podman = v
- }
- run := podman + " info --format=json"
-
- var buffer bytes.Buffer
- session.Stdout = &buffer
- if err := session.Run(run); err != nil {
- return "", errors.Wrapf(err, "failed to run %q", run)
- }
-
- var info define.Info
- if err := json.Unmarshal(buffer.Bytes(), &info); err != nil {
- return "", errors.Wrapf(err, "failed to parse 'podman info' results")
- }
-
- if info.Host.RemoteSocket == nil || len(info.Host.RemoteSocket.Path) == 0 {
- return "", fmt.Errorf("remote podman %q failed to report its UDS socket", uri.Host)
- }
- return info.Host.RemoteSocket.Path, nil
}
diff --git a/cmd/podman/system/connection/add.go b/cmd/podman/system/connection/add.go
new file mode 100644
index 000000000..89cea10ca
--- /dev/null
+++ b/cmd/podman/system/connection/add.go
@@ -0,0 +1,223 @@
+package connection
+
+import (
+ "bytes"
+ "encoding/json"
+ "fmt"
+ "net"
+ "net/url"
+ "os"
+ "os/user"
+ "regexp"
+
+ "github.com/containers/common/pkg/config"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/system"
+ "github.com/containers/podman/v2/libpod/define"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/terminal"
+ "github.com/pkg/errors"
+ "github.com/sirupsen/logrus"
+ "github.com/spf13/cobra"
+ "golang.org/x/crypto/ssh"
+ "golang.org/x/crypto/ssh/agent"
+)
+
+const schemaPattern = "^[A-Za-z][A-Za-z0-9+.-]*:"
+
+var (
+ addCmd = &cobra.Command{
+ Use: "add [flags] NAME DESTINATION",
+ Args: cobra.ExactArgs(2),
+ Short: "Record destination for the Podman service",
+ Long: `Add destination to podman configuration.
+ "destination" is of the form [user@]hostname or
+ an URI of the form ssh://[user@]hostname[:port]
+`,
+ RunE: add,
+ Example: `podman system connection add laptop server.fubar.com
+ podman system connection add --identity ~/.ssh/dev_rsa testing ssh://root@server.fubar.com:2222
+ podman system connection add --identity ~/.ssh/dev_rsa --port 22 production root@server.fubar.com
+ `,
+ }
+
+ cOpts = struct {
+ Identity string
+ Port int
+ UDSPath string
+ Default bool
+ }{}
+)
+
+func init() {
+ registry.Commands = append(registry.Commands, registry.CliCommand{
+ Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
+ Command: addCmd,
+ Parent: system.ConnectionCmd,
+ })
+
+ flags := addCmd.Flags()
+ flags.IntVarP(&cOpts.Port, "port", "p", 22, "SSH port number for destination")
+ flags.StringVar(&cOpts.Identity, "identity", "", "path to SSH identity file")
+ flags.StringVar(&cOpts.UDSPath, "socket-path", "", "path to podman socket on remote host. (default '/run/podman/podman.sock' or '/run/user/{uid}/podman/podman.sock)")
+ flags.BoolVarP(&cOpts.Default, "default", "d", false, "Set connection to be default")
+}
+
+func add(cmd *cobra.Command, args []string) error {
+ // Default to ssh: schema if none given
+ dest := args[1]
+ if match, err := regexp.Match(schemaPattern, []byte(dest)); err != nil {
+ return errors.Wrapf(err, "internal regex error %q", schemaPattern)
+ } else if !match {
+ dest = "ssh://" + dest
+ }
+
+ uri, err := url.Parse(dest)
+ if err != nil {
+ return errors.Wrapf(err, "failed to parse %q", dest)
+ }
+
+ if uri.User.Username() == "" {
+ if uri.User, err = getUserInfo(uri); err != nil {
+ return err
+ }
+ }
+
+ if cmd.Flags().Changed("socket-path") {
+ uri.Path = cmd.Flag("socket-path").Value.String()
+ }
+
+ if cmd.Flags().Changed("port") {
+ uri.Host = net.JoinHostPort(uri.Hostname(), cmd.Flag("port").Value.String())
+ }
+
+ if uri.Port() == "" {
+ uri.Host = net.JoinHostPort(uri.Hostname(), cmd.Flag("port").DefValue)
+ }
+
+ if uri.Path == "" {
+ if uri.Path, err = getUDS(cmd, uri); err != nil {
+ return errors.Wrapf(err, "failed to connect to %q", uri.String())
+ }
+ }
+
+ cfg, err := config.ReadCustomConfig()
+ if err != nil {
+ return err
+ }
+
+ if cmd.Flags().Changed("default") {
+ if cOpts.Default {
+ cfg.Engine.ActiveService = args[0]
+ }
+ }
+
+ dst := config.Destination{
+ URI: uri.String(),
+ }
+
+ if cmd.Flags().Changed("identity") {
+ dst.Identity = cOpts.Identity
+ }
+
+ if cfg.Engine.ServiceDestinations == nil {
+ cfg.Engine.ServiceDestinations = map[string]config.Destination{
+ args[0]: dst,
+ }
+ } else {
+ cfg.Engine.ServiceDestinations[args[0]] = dst
+ }
+ return cfg.Write()
+}
+
+func getUserInfo(uri *url.URL) (*url.Userinfo, error) {
+ var (
+ usr *user.User
+ err error
+ )
+ if u, found := os.LookupEnv("_CONTAINERS_ROOTLESS_UID"); found {
+ usr, err = user.LookupId(u)
+ if err != nil {
+ return nil, errors.Wrapf(err, "failed to find user %q", u)
+ }
+ } else {
+ usr, err = user.Current()
+ if err != nil {
+ return nil, errors.Wrapf(err, "failed to obtain current user")
+ }
+ }
+
+ pw, set := uri.User.Password()
+ if set {
+ return url.UserPassword(usr.Username, pw), nil
+ }
+ return url.User(usr.Username), nil
+}
+
+func getUDS(cmd *cobra.Command, uri *url.URL) (string, error) {
+ var authMethods []ssh.AuthMethod
+ passwd, set := uri.User.Password()
+ if set {
+ authMethods = append(authMethods, ssh.Password(passwd))
+ }
+
+ if cmd.Flags().Changed("identity") {
+ value := cmd.Flag("identity").Value.String()
+ auth, err := terminal.PublicKey(value, []byte(passwd))
+ if err != nil {
+ return "", errors.Wrapf(err, "Failed to read identity %q", value)
+ }
+ authMethods = append(authMethods, auth)
+ }
+
+ if sock, found := os.LookupEnv("SSH_AUTH_SOCK"); found {
+ logrus.Debugf("Found SSH_AUTH_SOCK %q, ssh-agent signer enabled", sock)
+
+ c, err := net.Dial("unix", sock)
+ if err != nil {
+ return "", err
+ }
+ a := agent.NewClient(c)
+ authMethods = append(authMethods, ssh.PublicKeysCallback(a.Signers))
+ }
+
+ config := &ssh.ClientConfig{
+ User: uri.User.Username(),
+ Auth: authMethods,
+ HostKeyCallback: ssh.InsecureIgnoreHostKey(),
+ }
+ dial, err := ssh.Dial("tcp", uri.Host, config)
+ if err != nil {
+ return "", errors.Wrapf(err, "failed to connect to %q", uri.Host)
+ }
+ defer dial.Close()
+
+ session, err := dial.NewSession()
+ if err != nil {
+ return "", errors.Wrapf(err, "failed to create new ssh session on %q", uri.Host)
+ }
+ defer session.Close()
+
+ // Override podman binary for testing etc
+ podman := "podman"
+ if v, found := os.LookupEnv("PODMAN_BINARY"); found {
+ podman = v
+ }
+ run := podman + " info --format=json"
+
+ var buffer bytes.Buffer
+ session.Stdout = &buffer
+ if err := session.Run(run); err != nil {
+ return "", errors.Wrapf(err, "failed to run %q", run)
+ }
+
+ var info define.Info
+ if err := json.Unmarshal(buffer.Bytes(), &info); err != nil {
+ return "", errors.Wrapf(err, "failed to parse 'podman info' results")
+ }
+
+ if info.Host.RemoteSocket == nil || len(info.Host.RemoteSocket.Path) == 0 {
+ return "", fmt.Errorf("remote podman %q failed to report its UDS socket", uri.Host)
+ }
+ return info.Host.RemoteSocket.Path, nil
+}
diff --git a/cmd/podman/system/connection/default.go b/cmd/podman/system/connection/default.go
new file mode 100644
index 000000000..eafcf37b2
--- /dev/null
+++ b/cmd/podman/system/connection/default.go
@@ -0,0 +1,46 @@
+package connection
+
+import (
+ "fmt"
+
+ "github.com/containers/common/pkg/config"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/system"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/spf13/cobra"
+)
+
+var (
+ // Skip creating engines since this command will obtain connection information to said engines
+ dfltCmd = &cobra.Command{
+ Use: "default NAME",
+ Args: cobra.ExactArgs(1),
+ Short: "Set named destination as default",
+ Long: `Set named destination as default for the Podman service`,
+ DisableFlagsInUseLine: true,
+ RunE: defaultRunE,
+ Example: `podman system connection default testing`,
+ }
+)
+
+func init() {
+ registry.Commands = append(registry.Commands, registry.CliCommand{
+ Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
+ Command: dfltCmd,
+ Parent: system.ConnectionCmd,
+ })
+}
+
+func defaultRunE(cmd *cobra.Command, args []string) error {
+ cfg, err := config.ReadCustomConfig()
+ if err != nil {
+ return err
+ }
+
+ if _, found := cfg.Engine.ServiceDestinations[args[0]]; !found {
+ return fmt.Errorf("%q destination is not defined. See \"podman system connection add ...\" to create a connection", args[0])
+ }
+
+ cfg.Engine.ActiveService = args[0]
+ return cfg.Write()
+}
diff --git a/cmd/podman/system/connection/list.go b/cmd/podman/system/connection/list.go
new file mode 100644
index 000000000..6d3d85d11
--- /dev/null
+++ b/cmd/podman/system/connection/list.go
@@ -0,0 +1,84 @@
+package connection
+
+import (
+ "os"
+ "text/tabwriter"
+ "text/template"
+
+ "github.com/containers/common/pkg/config"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/system"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/spf13/cobra"
+)
+
+var (
+ listCmd = &cobra.Command{
+ Use: "list",
+ Aliases: []string{"ls"},
+ Args: validate.NoArgs,
+ Short: "List destination for the Podman service(s)",
+ Long: `List destination information for the Podman service(s) in podman configuration`,
+ DisableFlagsInUseLine: true,
+ Example: `podman system connection list
+ podman system connection ls`,
+ RunE: list,
+ TraverseChildren: false,
+ }
+)
+
+func init() {
+ registry.Commands = append(registry.Commands, registry.CliCommand{
+ Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
+ Command: listCmd,
+ Parent: system.ConnectionCmd,
+ })
+}
+
+type namedDestination struct {
+ Name string
+ config.Destination
+}
+
+func list(_ *cobra.Command, _ []string) error {
+ cfg, err := config.ReadCustomConfig()
+ if err != nil {
+ return err
+ }
+
+ if len(cfg.Engine.ServiceDestinations) == 0 {
+ return nil
+ }
+
+ hdrs := []map[string]string{{
+ "Identity": "Identity",
+ "Name": "Name",
+ "URI": "URI",
+ }}
+
+ rows := make([]namedDestination, 0)
+ for k, v := range cfg.Engine.ServiceDestinations {
+ if k == cfg.Engine.ActiveService {
+ k += "*"
+ }
+
+ r := namedDestination{
+ Name: k,
+ Destination: config.Destination{
+ Identity: v.Identity,
+ URI: v.URI,
+ },
+ }
+ rows = append(rows, r)
+ }
+
+ // TODO: Allow user to override format
+ format := "{{range . }}{{.Name}}\t{{.Identity}}\t{{.URI}}\n{{end}}"
+ tmpl := template.Must(template.New("connection").Parse(format))
+ w := tabwriter.NewWriter(os.Stdout, 8, 2, 2, ' ', 0)
+ defer w.Flush()
+
+ _ = tmpl.Execute(w, hdrs)
+ return tmpl.Execute(w, rows)
+}
diff --git a/cmd/podman/system/connection/remove.go b/cmd/podman/system/connection/remove.go
new file mode 100644
index 000000000..58674efb6
--- /dev/null
+++ b/cmd/podman/system/connection/remove.go
@@ -0,0 +1,49 @@
+package connection
+
+import (
+ "github.com/containers/common/pkg/config"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/system"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/spf13/cobra"
+)
+
+var (
+ // Skip creating engines since this command will obtain connection information to said engines
+ rmCmd = &cobra.Command{
+ Use: "remove NAME",
+ Args: cobra.ExactArgs(1),
+ Aliases: []string{"rm"},
+ Long: `Delete named destination from podman configuration`,
+ Short: "Delete named destination",
+ DisableFlagsInUseLine: true,
+ RunE: rm,
+ Example: `podman system connection remove devl
+ podman system connection rm devl`,
+ }
+)
+
+func init() {
+ registry.Commands = append(registry.Commands, registry.CliCommand{
+ Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
+ Command: rmCmd,
+ Parent: system.ConnectionCmd,
+ })
+}
+
+func rm(_ *cobra.Command, args []string) error {
+ cfg, err := config.ReadCustomConfig()
+ if err != nil {
+ return err
+ }
+
+ if cfg.Engine.ServiceDestinations != nil {
+ delete(cfg.Engine.ServiceDestinations, args[0])
+ }
+
+ if cfg.Engine.ActiveService == args[0] {
+ cfg.Engine.ActiveService = ""
+ }
+
+ return cfg.Write()
+}
diff --git a/cmd/podman/system/connection/rename.go b/cmd/podman/system/connection/rename.go
new file mode 100644
index 000000000..bb2ca262a
--- /dev/null
+++ b/cmd/podman/system/connection/rename.go
@@ -0,0 +1,54 @@
+package connection
+
+import (
+ "fmt"
+
+ "github.com/containers/common/pkg/config"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/system"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/spf13/cobra"
+)
+
+var (
+ // Skip creating engines since this command will obtain connection information to said engines
+ renameCmd = &cobra.Command{
+ Use: "rename OLD NEW",
+ Aliases: []string{"mv"},
+ Args: cobra.ExactArgs(2),
+ Short: "Rename \"old\" to \"new\"",
+ Long: `Rename destination for the Podman service from "old" to "new"`,
+ DisableFlagsInUseLine: true,
+ RunE: rename,
+ Example: `podman system connection rename laptop devl,
+ podman system connection mv laptop devl`,
+ }
+)
+
+func init() {
+ registry.Commands = append(registry.Commands, registry.CliCommand{
+ Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
+ Command: renameCmd,
+ Parent: system.ConnectionCmd,
+ })
+}
+
+func rename(cmd *cobra.Command, args []string) error {
+ cfg, err := config.ReadCustomConfig()
+ if err != nil {
+ return err
+ }
+
+ if _, found := cfg.Engine.ServiceDestinations[args[0]]; !found {
+ return fmt.Errorf("%q destination is not defined. See \"podman system connection add ...\" to create a connection", args[0])
+ }
+
+ cfg.Engine.ServiceDestinations[args[1]] = cfg.Engine.ServiceDestinations[args[0]]
+ delete(cfg.Engine.ServiceDestinations, args[0])
+
+ if cfg.Engine.ActiveService == args[0] {
+ cfg.Engine.ActiveService = args[1]
+ }
+
+ return cfg.Write()
+}
diff --git a/cmd/podman/system/df.go b/cmd/podman/system/df.go
index c2308f0cc..a320eb5c7 100644
--- a/cmd/podman/system/df.go
+++ b/cmd/podman/system/df.go
@@ -2,16 +2,16 @@ package system
import (
"fmt"
- "html/template"
"io"
"os"
"strings"
"text/tabwriter"
+ "text/template"
"time"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/docker/go-units"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/system/events.go b/cmd/podman/system/events.go
index 246611c1a..04e948f30 100644
--- a/cmd/podman/system/events.go
+++ b/cmd/podman/system/events.go
@@ -3,15 +3,15 @@ package system
import (
"bufio"
"context"
- "html/template"
"os"
"strings"
+ "text/template"
"github.com/containers/buildah/pkg/formats"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/libpod/events"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/libpod/events"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/system/info.go b/cmd/podman/system/info.go
index 410b3455a..3e3c99488 100644
--- a/cmd/podman/system/info.go
+++ b/cmd/podman/system/info.go
@@ -5,10 +5,10 @@ import (
"os"
"text/template"
- "github.com/containers/libpod/v2/cmd/podman/parse"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/parse"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/ghodss/yaml"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
diff --git a/cmd/podman/system/migrate.go b/cmd/podman/system/migrate.go
index cb67ae760..018701fc9 100644
--- a/cmd/podman/system/migrate.go
+++ b/cmd/podman/system/migrate.go
@@ -6,10 +6,10 @@ import (
"fmt"
"os"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/domain/infra"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/domain/infra"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/system/prune.go b/cmd/podman/system/prune.go
index 26b2a704f..f34df3698 100644
--- a/cmd/podman/system/prune.go
+++ b/cmd/podman/system/prune.go
@@ -7,10 +7,10 @@ import (
"os"
"strings"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/utils"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/utils"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/system/renumber.go b/cmd/podman/system/renumber.go
index 82cf65d8f..1631ab093 100644
--- a/cmd/podman/system/renumber.go
+++ b/cmd/podman/system/renumber.go
@@ -6,10 +6,10 @@ import (
"fmt"
"os"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/domain/infra"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/domain/infra"
"github.com/spf13/cobra"
)
@@ -18,7 +18,7 @@ var (
podman system renumber
Migrate lock numbers to handle a change in maximum number of locks.
- Mandatory after the number of locks in libpod.conf is changed.
+ Mandatory after the number of locks in containers.conf is changed.
`
renumberCommand = &cobra.Command{
diff --git a/cmd/podman/system/reset.go b/cmd/podman/system/reset.go
index 9b4493391..a7a42ea58 100644
--- a/cmd/podman/system/reset.go
+++ b/cmd/podman/system/reset.go
@@ -8,10 +8,10 @@ import (
"os"
"strings"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/domain/infra"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/domain/infra"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/system/service.go b/cmd/podman/system/service.go
index 312fcda19..2d511f0ec 100644
--- a/cmd/podman/system/service.go
+++ b/cmd/podman/system/service.go
@@ -9,11 +9,11 @@ import (
"syscall"
"time"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/rootless"
- "github.com/containers/libpod/v2/pkg/systemd"
- "github.com/containers/libpod/v2/pkg/util"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/rootless"
+ "github.com/containers/podman/v2/pkg/systemd"
+ "github.com/containers/podman/v2/pkg/util"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
diff --git a/cmd/podman/system/service_abi.go b/cmd/podman/system/service_abi.go
index 4baa0f6bf..6c6dd42a4 100644
--- a/cmd/podman/system/service_abi.go
+++ b/cmd/podman/system/service_abi.go
@@ -7,9 +7,9 @@ import (
"net"
"strings"
- api "github.com/containers/libpod/v2/pkg/api/server"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/domain/infra"
+ api "github.com/containers/podman/v2/pkg/api/server"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/domain/infra"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/pflag"
diff --git a/cmd/podman/system/system.go b/cmd/podman/system/system.go
index 2dd6cf774..388905035 100644
--- a/cmd/podman/system/system.go
+++ b/cmd/podman/system/system.go
@@ -1,9 +1,9 @@
package system
import (
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/system/unshare.go b/cmd/podman/system/unshare.go
index bd6540e4b..2d0113779 100644
--- a/cmd/podman/system/unshare.go
+++ b/cmd/podman/system/unshare.go
@@ -3,9 +3,9 @@ package system
import (
"os"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
- "github.com/containers/libpod/v2/pkg/rootless"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/rootless"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/system/varlink.go b/cmd/podman/system/varlink.go
index e5d83180e..57e7e4ba6 100644
--- a/cmd/podman/system/varlink.go
+++ b/cmd/podman/system/varlink.go
@@ -5,8 +5,8 @@ package system
import (
"time"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/system/version.go b/cmd/podman/system/version.go
index 9b70bc9f4..edc860d0e 100644
--- a/cmd/podman/system/version.go
+++ b/cmd/podman/system/version.go
@@ -8,11 +8,11 @@ import (
"text/tabwriter"
"github.com/containers/buildah/pkg/formats"
- "github.com/containers/libpod/v2/cmd/podman/parse"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/libpod/define"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/parse"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/libpod/define"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/utils/utils.go b/cmd/podman/utils/utils.go
index 029ed526e..1c9e4d786 100644
--- a/cmd/podman/utils/utils.go
+++ b/cmd/podman/utils/utils.go
@@ -4,7 +4,7 @@ import (
"fmt"
"os"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/domain/entities"
)
// IsDir returns true if the specified path refers to a directory.
diff --git a/cmd/podman/validate/latest.go b/cmd/podman/validate/latest.go
index 0ebed7227..5c76fe847 100644
--- a/cmd/podman/validate/latest.go
+++ b/cmd/podman/validate/latest.go
@@ -1,7 +1,7 @@
package validate
import (
- "github.com/containers/libpod/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/registry"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/volumes/create.go b/cmd/podman/volumes/create.go
index 2710014ef..934a552dc 100644
--- a/cmd/podman/volumes/create.go
+++ b/cmd/podman/volumes/create.go
@@ -4,9 +4,9 @@ import (
"context"
"fmt"
- "github.com/containers/libpod/v2/cmd/podman/parse"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/parse"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/volumes/inspect.go b/cmd/podman/volumes/inspect.go
index 9a8f4049b..ce24ac4e5 100644
--- a/cmd/podman/volumes/inspect.go
+++ b/cmd/podman/volumes/inspect.go
@@ -2,13 +2,13 @@ package volumes
import (
"fmt"
- "html/template"
"os"
"strings"
+ "text/template"
"github.com/containers/buildah/pkg/formats"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"golang.org/x/net/context"
diff --git a/cmd/podman/volumes/list.go b/cmd/podman/volumes/list.go
index 9e3a8f77b..d198e51a7 100644
--- a/cmd/podman/volumes/list.go
+++ b/cmd/podman/volumes/list.go
@@ -3,15 +3,15 @@ package volumes
import (
"context"
"fmt"
- "html/template"
"io"
"os"
"strings"
"text/tabwriter"
+ "text/template"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/volumes/prune.go b/cmd/podman/volumes/prune.go
index 330488e0d..95b47b726 100644
--- a/cmd/podman/volumes/prune.go
+++ b/cmd/podman/volumes/prune.go
@@ -7,10 +7,10 @@ import (
"os"
"strings"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/utils"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/utils"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/volumes/rm.go b/cmd/podman/volumes/rm.go
index 2636ad1a2..5b23eb5e6 100644
--- a/cmd/podman/volumes/rm.go
+++ b/cmd/podman/volumes/rm.go
@@ -4,9 +4,9 @@ import (
"context"
"fmt"
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/utils"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/utils"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
diff --git a/cmd/podman/volumes/volume.go b/cmd/podman/volumes/volume.go
index 3ef20a027..cd7a1a642 100644
--- a/cmd/podman/volumes/volume.go
+++ b/cmd/podman/volumes/volume.go
@@ -1,9 +1,9 @@
package volumes
import (
- "github.com/containers/libpod/v2/cmd/podman/registry"
- "github.com/containers/libpod/v2/cmd/podman/validate"
- "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/validate"
+ "github.com/containers/podman/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)