summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/multi-arch-build.yaml42
-rw-r--r--cmd/podman/README.md6
-rw-r--r--cmd/podman/auto-update.go2
-rw-r--r--cmd/podman/common/create_opts.go7
-rw-r--r--cmd/podman/common/netflags.go2
-rw-r--r--cmd/podman/completion/completion.go2
-rw-r--r--cmd/podman/containers/attach.go2
-rw-r--r--cmd/podman/containers/checkpoint.go1
-rw-r--r--cmd/podman/containers/cleanup.go10
-rw-r--r--cmd/podman/containers/commit.go2
-rw-r--r--cmd/podman/containers/container.go2
-rw-r--r--cmd/podman/containers/cp.go2
-rw-r--r--cmd/podman/containers/create.go4
-rw-r--r--cmd/podman/containers/diff.go1
-rw-r--r--cmd/podman/containers/exec.go24
-rw-r--r--cmd/podman/containers/exists.go8
-rw-r--r--cmd/podman/containers/export.go2
-rw-r--r--cmd/podman/containers/init.go2
-rw-r--r--cmd/podman/containers/inspect.go1
-rw-r--r--cmd/podman/containers/kill.go2
-rw-r--r--cmd/podman/containers/list.go2
-rw-r--r--cmd/podman/containers/logs.go2
-rw-r--r--cmd/podman/containers/mount.go13
-rw-r--r--cmd/podman/containers/pause.go2
-rw-r--r--cmd/podman/containers/port.go2
-rw-r--r--cmd/podman/containers/prune.go1
-rw-r--r--cmd/podman/containers/ps.go2
-rw-r--r--cmd/podman/containers/rename.go2
-rw-r--r--cmd/podman/containers/restart.go3
-rw-r--r--cmd/podman/containers/restore.go1
-rw-r--r--cmd/podman/containers/rm.go14
-rw-r--r--cmd/podman/containers/run.go10
-rw-r--r--cmd/podman/containers/runlabel.go2
-rw-r--r--cmd/podman/containers/start.go2
-rw-r--r--cmd/podman/containers/stats.go2
-rw-r--r--cmd/podman/containers/stop.go2
-rw-r--r--cmd/podman/containers/top.go2
-rw-r--r--cmd/podman/containers/unmount.go24
-rw-r--r--cmd/podman/containers/unpause.go2
-rw-r--r--cmd/podman/containers/wait.go2
-rw-r--r--cmd/podman/diff.go1
-rw-r--r--cmd/podman/generate/generate.go2
-rw-r--r--cmd/podman/generate/kube.go1
-rw-r--r--cmd/podman/generate/systemd.go1
-rw-r--r--cmd/podman/healthcheck/healthcheck.go3
-rw-r--r--cmd/podman/healthcheck/run.go21
-rw-r--r--cmd/podman/images/build.go3
-rw-r--r--cmd/podman/images/diff.go1
-rw-r--r--cmd/podman/images/exists.go3
-rw-r--r--cmd/podman/images/history.go2
-rw-r--r--cmd/podman/images/image.go2
-rw-r--r--cmd/podman/images/images.go32
-rw-r--r--cmd/podman/images/import.go2
-rw-r--r--cmd/podman/images/inspect.go1
-rw-r--r--cmd/podman/images/list.go26
-rw-r--r--cmd/podman/images/load.go2
-rw-r--r--cmd/podman/images/mount.go10
-rw-r--r--cmd/podman/images/prune.go1
-rw-r--r--cmd/podman/images/pull.go2
-rw-r--r--cmd/podman/images/push.go2
-rw-r--r--cmd/podman/images/rm.go18
-rw-r--r--cmd/podman/images/rmi.go29
-rw-r--r--cmd/podman/images/save.go3
-rw-r--r--cmd/podman/images/search.go7
-rw-r--r--cmd/podman/images/sign.go2
-rw-r--r--cmd/podman/images/tag.go28
-rw-r--r--cmd/podman/images/tree.go1
-rw-r--r--cmd/podman/images/trust.go11
-rw-r--r--cmd/podman/images/trust_set.go2
-rw-r--r--cmd/podman/images/trust_show.go2
-rw-r--r--cmd/podman/images/unmount.go2
-rw-r--r--cmd/podman/images/untag.go36
-rw-r--r--cmd/podman/inspect.go1
-rw-r--r--cmd/podman/login.go2
-rw-r--r--cmd/podman/logout.go2
-rw-r--r--cmd/podman/machine/init.go6
-rw-r--r--cmd/podman/machine/list.go16
-rw-r--r--cmd/podman/machine/machine.go2
-rw-r--r--cmd/podman/machine/machine_unsupported.go1
-rw-r--r--cmd/podman/machine/rm.go2
-rw-r--r--cmd/podman/machine/ssh.go2
-rw-r--r--cmd/podman/machine/start.go2
-rw-r--r--cmd/podman/machine/stop.go2
-rw-r--r--cmd/podman/main.go60
-rw-r--r--cmd/podman/manifest/add.go1
-rw-r--r--cmd/podman/manifest/annotate.go2
-rw-r--r--cmd/podman/manifest/create.go1
-rw-r--r--cmd/podman/manifest/exists.go2
-rw-r--r--cmd/podman/manifest/inspect.go17
-rw-r--r--cmd/podman/manifest/manifest.go2
-rw-r--r--cmd/podman/manifest/push.go1
-rw-r--r--cmd/podman/manifest/remove.go17
-rw-r--r--cmd/podman/manifest/rm.go17
-rw-r--r--cmd/podman/networks/connect.go1
-rw-r--r--cmd/podman/networks/create.go1
-rw-r--r--cmd/podman/networks/disconnect.go1
-rw-r--r--cmd/podman/networks/exists.go2
-rw-r--r--cmd/podman/networks/inspect.go1
-rw-r--r--cmd/podman/networks/list.go1
-rw-r--r--cmd/podman/networks/network.go2
-rw-r--r--cmd/podman/networks/prune.go1
-rw-r--r--cmd/podman/networks/reload.go10
-rw-r--r--cmd/podman/networks/rm.go1
-rw-r--r--cmd/podman/play/kube.go1
-rw-r--r--cmd/podman/play/play.go2
-rw-r--r--cmd/podman/pods/create.go1
-rw-r--r--cmd/podman/pods/exists.go3
-rw-r--r--cmd/podman/pods/inspect.go1
-rw-r--r--cmd/podman/pods/kill.go1
-rw-r--r--cmd/podman/pods/pause.go1
-rw-r--r--cmd/podman/pods/pod.go2
-rw-r--r--cmd/podman/pods/prune.go1
-rw-r--r--cmd/podman/pods/ps.go1
-rw-r--r--cmd/podman/pods/restart.go1
-rw-r--r--cmd/podman/pods/rm.go1
-rw-r--r--cmd/podman/pods/start.go1
-rw-r--r--cmd/podman/pods/stats.go1
-rw-r--r--cmd/podman/pods/stop.go1
-rw-r--r--cmd/podman/pods/top.go1
-rw-r--r--cmd/podman/pods/unpause.go1
-rw-r--r--cmd/podman/registry/config.go13
-rw-r--r--cmd/podman/registry/registry.go1
-rw-r--r--cmd/podman/secrets/create.go1
-rw-r--r--cmd/podman/secrets/inspect.go1
-rw-r--r--cmd/podman/secrets/list.go1
-rw-r--r--cmd/podman/secrets/rm.go1
-rw-r--r--cmd/podman/secrets/secret.go2
-rw-r--r--cmd/podman/system/connection.go17
-rw-r--r--cmd/podman/system/connection/add.go2
-rw-r--r--cmd/podman/system/connection/default.go17
-rw-r--r--cmd/podman/system/connection/list.go13
-rw-r--r--cmd/podman/system/connection/remove.go17
-rw-r--r--cmd/podman/system/connection/rename.go17
-rw-r--r--cmd/podman/system/df.go1
-rw-r--r--cmd/podman/system/events.go1
-rw-r--r--cmd/podman/system/info.go3
-rw-r--r--cmd/podman/system/migrate.go2
-rw-r--r--cmd/podman/system/prune.go1
-rw-r--r--cmd/podman/system/renumber.go15
-rw-r--r--cmd/podman/system/reset.go2
-rw-r--r--cmd/podman/system/service.go2
-rw-r--r--cmd/podman/system/system.go2
-rw-r--r--cmd/podman/system/unshare.go13
-rw-r--r--cmd/podman/system/version.go1
-rw-r--r--cmd/podman/volumes/create.go1
-rw-r--r--cmd/podman/volumes/exists.go2
-rw-r--r--cmd/podman/volumes/inspect.go1
-rw-r--r--cmd/podman/volumes/list.go1
-rw-r--r--cmd/podman/volumes/prune.go1
-rw-r--r--cmd/podman/volumes/rm.go1
-rw-r--r--cmd/podman/volumes/volume.go2
-rw-r--r--docs/source/markdown/podman-manifest-add.1.md22
-rw-r--r--go.mod6
-rw-r--r--go.sum14
-rw-r--r--libpod/container.go3
-rw-r--r--libpod/container_log_linux.go276
-rw-r--r--libpod/network/config.go43
-rw-r--r--libpod/network/netconflist.go18
-rw-r--r--libpod/runtime.go17
-rw-r--r--libpod/runtime_ctr.go9
-rw-r--r--pkg/api/handlers/compat/containers_create.go2
-rw-r--r--pkg/machine/qemu/machine.go2
-rw-r--r--pkg/specgen/generate/kube/kube.go14
-rw-r--r--pkg/specgen/generate/namespaces.go2
-rw-r--r--pkg/specgen/generate/ports.go49
-rw-r--r--pkg/specgen/namespaces.go8
-rw-r--r--test/e2e/logs_test.go2
-rw-r--r--test/e2e/network_test.go26
-rw-r--r--test/e2e/run_device_test.go6
-rw-r--r--test/e2e/run_networking_test.go14
-rw-r--r--test/system/035-logs.bats52
-rw-r--r--test/system/130-kill.bats3
-rw-r--r--test/system/700-play.bats41
-rw-r--r--transfer.md116
-rw-r--r--vendor/github.com/containers/common/libimage/image.go19
-rw-r--r--vendor/github.com/containers/common/libimage/pull.go1
-rw-r--r--vendor/github.com/containers/common/libimage/runtime.go8
-rw-r--r--vendor/github.com/containers/common/pkg/config/config.go5
-rw-r--r--vendor/github.com/containers/common/pkg/config/containers.conf3
-rw-r--r--vendor/github.com/containers/common/pkg/config/default.go50
-rw-r--r--vendor/github.com/containers/common/pkg/defaultnet/default_network.go222
-rw-r--r--vendor/github.com/containers/common/version/version.go2
-rw-r--r--vendor/github.com/containers/storage/VERSION2
-rw-r--r--vendor/github.com/containers/storage/containers.go2
-rw-r--r--vendor/github.com/containers/storage/drivers/devmapper/deviceset.go4
-rw-r--r--vendor/github.com/containers/storage/drivers/driver.go7
-rw-r--r--vendor/github.com/containers/storage/drivers/overlay/overlay.go46
-rw-r--r--vendor/github.com/containers/storage/go.mod2
-rw-r--r--vendor/github.com/containers/storage/go.sum4
-rw-r--r--vendor/github.com/containers/storage/images.go2
-rw-r--r--vendor/github.com/containers/storage/layers.go134
-rw-r--r--vendor/github.com/containers/storage/store.go34
-rw-r--r--vendor/github.com/klauspost/compress/flate/deflate.go2
-rw-r--r--vendor/github.com/klauspost/compress/flate/fast_encoder.go2
-rw-r--r--vendor/github.com/klauspost/compress/flate/huffman_bit_writer.go246
-rw-r--r--vendor/github.com/klauspost/compress/flate/huffman_code.go58
-rw-r--r--vendor/github.com/klauspost/compress/flate/token.go41
-rw-r--r--vendor/github.com/klauspost/compress/zstd/README.md22
-rw-r--r--vendor/github.com/klauspost/compress/zstd/blockdec.go11
-rw-r--r--vendor/github.com/klauspost/compress/zstd/bytebuf.go21
-rw-r--r--vendor/github.com/klauspost/compress/zstd/framedec.go46
-rw-r--r--vendor/github.com/klauspost/compress/zstd/zip.go5
-rw-r--r--vendor/github.com/onsi/gomega/CHANGELOG.md6
-rw-r--r--vendor/github.com/onsi/gomega/env.go40
-rw-r--r--vendor/github.com/onsi/gomega/gomega_dsl.go2
-rw-r--r--vendor/github.com/onsi/gomega/internal/defaults/env.go22
-rw-r--r--vendor/modules.txt10
207 files changed, 1634 insertions, 1022 deletions
diff --git a/.github/workflows/multi-arch-build.yaml b/.github/workflows/multi-arch-build.yaml
index 0f8a3df7e..2ade44ee6 100644
--- a/.github/workflows/multi-arch-build.yaml
+++ b/.github/workflows/multi-arch-build.yaml
@@ -2,6 +2,11 @@
# Please see contrib/podmanimage/README.md for details on the intentions
# of this workflow.
+#
+# BIG FAT WARNING: This workflow is duplicated across containers/skopeo,
+# containers/buildah, and containers/podman. ANY AND
+# ALL CHANGES MADE HERE MUST BE MANUALLY DUPLICATED
+# TO THE OTHER REPOS.
name: build multi-arch images
@@ -86,7 +91,7 @@ jobs:
docker://$PODMAN_QUAY_REGISTRY/stable | \
jq -r '.Tags[]')
- # New image? Push quay.io/podman/stable:vX.X.X and :latest
+ # New version? Push quay.io/podman/stable:vX.X.X and :latest
if ! fgrep -qx "$VERSION" <<<"$ALLTAGS"; then
# Assume version-tag is also the most up to date (i.e. "latest")
FQIN="$PODMAN_QUAY_REGISTRY/stable:$VERSION,$PODMAN_QUAY_REGISTRY/stable:latest"
@@ -108,31 +113,24 @@ jobs:
echo "::set-output name=fqin::${FQIN}"
echo '::set-output name=push::true'
- # This is substantially the same as the above step, except the
- # $CONTAINERS_QUAY_REGISTRY is used and the "testing"
- # flavor is never pushed.
+ # This is substantially similar to the above logic,
+ # but only handles $CONTAINERS_QUAY_REGISTRY for
+ # the stable "latest" and named-version tagged images.
- name: Generate containers reg. image FQIN(s)
- if: matrix.source != 'testing'
+ if: matrix.source == 'stable'
id: containers_reg
run: |
- if [[ "${{ matrix.source }}" == 'stable' ]]; then
- VERSION='v${{ steps.sniff_test.outputs.version }}'
- # workaround vim syntax-highlight bug: '
- ALLTAGS=$(skopeo list-tags \
- docker://$CONTAINERS_QUAY_REGISTRY/podman | \
- jq -r '.Tags[]')
-
- # New image? Push quay.io/containers/podman:vX.X.X and :latest
- if ! fgrep -qx "$VERSION" <<<"$ALLTAGS"; then
- FQIN="$CONTAINERS_QUAY_REGISTRY/podman:$VERSION,$CONTAINERS_QUAY_REGISTRY/podman:latest"
- else # Not a new version-tagged image, but contents may be updated
- FQIN="$CONTAINERS_QUAY_REGISTRY/podman:latest"
- fi
- elif [[ "${{ matrix.source }}" == 'upstream' ]]; then
+ VERSION='v${{ steps.sniff_test.outputs.version }}'
+ # workaround vim syntax-highlight bug: '
+ ALLTAGS=$(skopeo list-tags \
+ docker://$CONTAINERS_QUAY_REGISTRY/podman | \
+ jq -r '.Tags[]')
+
+ # New version? Push quay.io/containers/podman:vX.X.X and latest
+ if ! fgrep -qx "$VERSION" <<<"$ALLTAGS"; then
+ FQIN="$CONTAINERS_QUAY_REGISTRY/podman:$VERSION,$CONTAINERS_QUAY_REGISTRY/podman:latest"
+ else # Not a new version-tagged image, only update latest.
FQIN="$CONTAINERS_QUAY_REGISTRY/podman:latest"
- else
- echo "::error::Unknown matrix item '${{ matrix.source }}'"
- exit 1
fi
echo "::warning::Pushing $FQIN"
echo "::set-output name=fqin::${FQIN}"
diff --git a/cmd/podman/README.md b/cmd/podman/README.md
index 260c9bcfc..f2aa3f018 100644
--- a/cmd/podman/README.md
+++ b/cmd/podman/README.md
@@ -40,9 +40,6 @@ var (
func init() {
// Subscribe command to podman
registry.Commands = append(registry.Commands, registry.CliCommand{
- // _podman manifest_ will support both ABIMode and TunnelMode
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
- // The definition for this command
Command: manifestCmd,
})
}
@@ -83,9 +80,6 @@ var (
func init() {
// Subscribe inspect sub command to manifest command
registry.Commands = append(registry.Commands, registry.CliCommand{
- // _podman manifest inspect_ will support both ABIMode and TunnelMode
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
- // The definition for this command
Command: inspectCmd,
// The parent command to proceed this command on the CLI
Parent: manifestCmd,
diff --git a/cmd/podman/auto-update.go b/cmd/podman/auto-update.go
index a6d990b0c..99226790f 100644
--- a/cmd/podman/auto-update.go
+++ b/cmd/podman/auto-update.go
@@ -21,6 +21,7 @@ var (
or similar units that create new containers in order to run the updated images.
Please refer to the podman-auto-update(1) man page for details.`
autoUpdateCommand = &cobra.Command{
+ Annotations: map[string]string{registry.EngineMode: registry.ABIMode},
Use: "auto-update [options]",
Short: "Auto update containers according to their auto-update policy",
Long: autoUpdateDescription,
@@ -33,7 +34,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode},
Command: autoUpdateCommand,
})
diff --git a/cmd/podman/common/create_opts.go b/cmd/podman/common/create_opts.go
index 77ac781a5..76d7345fc 100644
--- a/cmd/podman/common/create_opts.go
+++ b/cmd/podman/common/create_opts.go
@@ -8,6 +8,7 @@ import (
"strconv"
"strings"
+ "github.com/containers/common/pkg/config"
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/pkg/api/handlers"
"github.com/containers/podman/v3/pkg/cgroups"
@@ -140,7 +141,7 @@ func stringMaptoArray(m map[string]string) []string {
// ContainerCreateToContainerCLIOpts converts a compat input struct to cliopts so it can be converted to
// a specgen spec.
-func ContainerCreateToContainerCLIOpts(cc handlers.CreateContainerConfig, cgroupsManager string) (*ContainerCLIOpts, []string, error) {
+func ContainerCreateToContainerCLIOpts(cc handlers.CreateContainerConfig, rtc *config.Config) (*ContainerCLIOpts, []string, error) {
var (
capAdd []string
cappDrop []string
@@ -248,7 +249,7 @@ func ContainerCreateToContainerCLIOpts(cc handlers.CreateContainerConfig, cgroup
}
// netMode
- nsmode, _, err := specgen.ParseNetworkNamespace(string(cc.HostConfig.NetworkMode))
+ nsmode, _, err := specgen.ParseNetworkNamespace(string(cc.HostConfig.NetworkMode), true)
if err != nil {
return nil, nil, err
}
@@ -507,7 +508,7 @@ func ContainerCreateToContainerCLIOpts(cc handlers.CreateContainerConfig, cgroup
cliOpts.Restart = policy
}
- if cc.HostConfig.MemorySwappiness != nil && (!rootless.IsRootless() || rootless.IsRootless() && cgroupsv2 && cgroupsManager == "systemd") {
+ if cc.HostConfig.MemorySwappiness != nil && (!rootless.IsRootless() || rootless.IsRootless() && cgroupsv2 && rtc.Engine.CgroupManager == "systemd") {
cliOpts.MemorySwappiness = *cc.HostConfig.MemorySwappiness
} else {
cliOpts.MemorySwappiness = -1
diff --git a/cmd/podman/common/netflags.go b/cmd/podman/common/netflags.go
index 4d0a554a6..9941bc716 100644
--- a/cmd/podman/common/netflags.go
+++ b/cmd/podman/common/netflags.go
@@ -201,7 +201,7 @@ func NetFlagsToNetOptions(cmd *cobra.Command) (*entities.NetOptions, error) {
parts := strings.SplitN(network, ":", 2)
- ns, cniNets, err := specgen.ParseNetworkNamespace(network)
+ ns, cniNets, err := specgen.ParseNetworkNamespace(network, containerConfig.Containers.RootlessNetworking == "cni")
if err != nil {
return nil, err
}
diff --git a/cmd/podman/completion/completion.go b/cmd/podman/completion/completion.go
index 472068130..da74eefdd 100644
--- a/cmd/podman/completion/completion.go
+++ b/cmd/podman/completion/completion.go
@@ -8,7 +8,6 @@ import (
commonComp "github.com/containers/common/pkg/completion"
"github.com/containers/podman/v3/cmd/podman/registry"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/spf13/cobra"
)
@@ -39,7 +38,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: completionCmd,
})
flags := completionCmd.Flags()
diff --git a/cmd/podman/containers/attach.go b/cmd/podman/containers/attach.go
index dae1126a9..acfa0357b 100644
--- a/cmd/podman/containers/attach.go
+++ b/cmd/podman/containers/attach.go
@@ -55,14 +55,12 @@ func attachFlags(cmd *cobra.Command) {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: attachCommand,
})
attachFlags(attachCommand)
validate.AddLatestFlag(attachCommand, &attachOpts.Latest)
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: containerAttachCommand,
Parent: containerCmd,
})
diff --git a/cmd/podman/containers/checkpoint.go b/cmd/podman/containers/checkpoint.go
index 25d0eb510..47d60453b 100644
--- a/cmd/podman/containers/checkpoint.go
+++ b/cmd/podman/containers/checkpoint.go
@@ -42,7 +42,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: checkpointCommand,
Parent: containerCmd,
})
diff --git a/cmd/podman/containers/cleanup.go b/cmd/podman/containers/cleanup.go
index 1f87725e9..98706c575 100644
--- a/cmd/podman/containers/cleanup.go
+++ b/cmd/podman/containers/cleanup.go
@@ -21,10 +21,11 @@ var (
Cleans up mount points and network stacks on one or more containers from the host. The container name or ID can be used. This command is used internally when running containers, but can also be used if container cleanup has failed when a container exits.
`
cleanupCommand = &cobra.Command{
- Use: "cleanup [options] CONTAINER [CONTAINER...]",
- Short: "Cleanup network and mountpoints of one or more containers",
- Long: cleanupDescription,
- RunE: cleanup,
+ Annotations: map[string]string{registry.EngineMode: registry.ABIMode},
+ Use: "cleanup [options] CONTAINER [CONTAINER...]",
+ Short: "Cleanup network and mountpoints of one or more containers",
+ Long: cleanupDescription,
+ RunE: cleanup,
Args: func(cmd *cobra.Command, args []string) error {
return validate.CheckAllLatestAndCIDFile(cmd, args, false, false)
},
@@ -41,7 +42,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode},
Parent: containerCmd,
Command: cleanupCommand,
})
diff --git a/cmd/podman/containers/commit.go b/cmd/podman/containers/commit.go
index 168ded356..f74f12851 100644
--- a/cmd/podman/containers/commit.go
+++ b/cmd/podman/containers/commit.go
@@ -82,13 +82,11 @@ func commitFlags(cmd *cobra.Command) {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: commitCommand,
})
commitFlags(commitCommand)
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: containerCommitCommand,
Parent: containerCmd,
})
diff --git a/cmd/podman/containers/container.go b/cmd/podman/containers/container.go
index c78668611..14e030bf4 100644
--- a/cmd/podman/containers/container.go
+++ b/cmd/podman/containers/container.go
@@ -3,7 +3,6 @@ package containers
import (
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/validate"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/util"
"github.com/spf13/cobra"
)
@@ -26,7 +25,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: containerCmd,
})
}
diff --git a/cmd/podman/containers/cp.go b/cmd/podman/containers/cp.go
index 27aacc6e5..2c7d72b20 100644
--- a/cmd/podman/containers/cp.go
+++ b/cmd/podman/containers/cp.go
@@ -62,13 +62,11 @@ func cpFlags(cmd *cobra.Command) {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: cpCommand,
})
cpFlags(cpCommand)
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: containerCpCommand,
Parent: containerCmd,
})
diff --git a/cmd/podman/containers/create.go b/cmd/podman/containers/create.go
index f06869c4e..07a859983 100644
--- a/cmd/podman/containers/create.go
+++ b/cmd/podman/containers/create.go
@@ -39,7 +39,7 @@ var (
}
containerCreateCommand = &cobra.Command{
- Args: cobra.MinimumNArgs(1),
+ Args: createCommand.Args,
Use: createCommand.Use,
Short: createCommand.Short,
Long: createCommand.Long,
@@ -72,13 +72,11 @@ func createFlags(cmd *cobra.Command) {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: createCommand,
})
createFlags(createCommand)
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: containerCreateCommand,
Parent: containerCmd,
})
diff --git a/cmd/podman/containers/diff.go b/cmd/podman/containers/diff.go
index 799d01127..0eee85825 100644
--- a/cmd/podman/containers/diff.go
+++ b/cmd/podman/containers/diff.go
@@ -27,7 +27,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: diffCmd,
Parent: containerCmd,
})
diff --git a/cmd/podman/containers/exec.go b/cmd/podman/containers/exec.go
index 15ac2b164..5d0da1514 100644
--- a/cmd/podman/containers/exec.go
+++ b/cmd/podman/containers/exec.go
@@ -21,24 +21,22 @@ var (
execDescription = `Execute the specified command inside a running container.
`
execCommand = &cobra.Command{
- Use: "exec [options] CONTAINER [COMMAND [ARG...]]",
- Short: "Run a process in a running container",
- Long: execDescription,
- RunE: exec,
- DisableFlagsInUseLine: true,
- ValidArgsFunction: common.AutocompleteExecCommand,
+ Use: "exec [options] CONTAINER [COMMAND [ARG...]]",
+ Short: "Run a process in a running container",
+ Long: execDescription,
+ RunE: exec,
+ ValidArgsFunction: common.AutocompleteExecCommand,
Example: `podman exec -it ctrID ls
podman exec -it -w /tmp myCtr pwd
podman exec --user root ctrID ls`,
}
containerExecCommand = &cobra.Command{
- Use: execCommand.Use,
- Short: execCommand.Short,
- Long: execCommand.Long,
- RunE: execCommand.RunE,
- DisableFlagsInUseLine: true,
- ValidArgsFunction: execCommand.ValidArgsFunction,
+ Use: execCommand.Use,
+ Short: execCommand.Short,
+ Long: execCommand.Long,
+ RunE: execCommand.RunE,
+ ValidArgsFunction: execCommand.ValidArgsFunction,
Example: `podman container exec -it ctrID ls
podman container exec -it -w /tmp myCtr pwd
podman container exec --user root ctrID ls`,
@@ -92,14 +90,12 @@ func execFlags(cmd *cobra.Command) {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: execCommand,
})
execFlags(execCommand)
validate.AddLatestFlag(execCommand, &execOpts.Latest)
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: containerExecCommand,
Parent: containerCmd,
})
diff --git a/cmd/podman/containers/exists.go b/cmd/podman/containers/exists.go
index c21b30a4b..cf7ac4c5d 100644
--- a/cmd/podman/containers/exists.go
+++ b/cmd/podman/containers/exists.go
@@ -18,16 +18,14 @@ var (
Long: containerExistsDescription,
Example: `podman container exists --external containerID
podman container exists myctr || podman run --name myctr [etc...]`,
- RunE: exists,
- Args: cobra.ExactArgs(1),
- DisableFlagsInUseLine: true,
- ValidArgsFunction: common.AutocompleteContainers,
+ RunE: exists,
+ Args: cobra.ExactArgs(1),
+ ValidArgsFunction: common.AutocompleteContainers,
}
)
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: existsCommand,
Parent: containerCmd,
})
diff --git a/cmd/podman/containers/export.go b/cmd/podman/containers/export.go
index 3ea55415c..e031578b8 100644
--- a/cmd/podman/containers/export.go
+++ b/cmd/podman/containers/export.go
@@ -55,13 +55,11 @@ func exportFlags(cmd *cobra.Command) {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: exportCommand,
})
exportFlags(exportCommand)
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: containerExportCommand,
Parent: containerCmd,
})
diff --git a/cmd/podman/containers/init.go b/cmd/podman/containers/init.go
index e874b9cb0..e68217478 100644
--- a/cmd/podman/containers/init.go
+++ b/cmd/podman/containers/init.go
@@ -52,7 +52,6 @@ func initFlags(flags *pflag.FlagSet) {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: initCommand,
})
flags := initCommand.Flags()
@@ -60,7 +59,6 @@ func init() {
validate.AddLatestFlag(initCommand, &initOptions.Latest)
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Parent: containerCmd,
Command: containerInitCommand,
})
diff --git a/cmd/podman/containers/inspect.go b/cmd/podman/containers/inspect.go
index eb29b7285..5a8ccc628 100644
--- a/cmd/podman/containers/inspect.go
+++ b/cmd/podman/containers/inspect.go
@@ -26,7 +26,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: inspectCmd,
Parent: containerCmd,
})
diff --git a/cmd/podman/containers/kill.go b/cmd/podman/containers/kill.go
index aa36b51fd..449484449 100644
--- a/cmd/podman/containers/kill.go
+++ b/cmd/podman/containers/kill.go
@@ -67,14 +67,12 @@ func killFlags(cmd *cobra.Command) {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: killCommand,
})
killFlags(killCommand)
validate.AddLatestFlag(killCommand, &killOptions.Latest)
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: containerKillCommand,
Parent: containerCmd,
})
diff --git a/cmd/podman/containers/list.go b/cmd/podman/containers/list.go
index 4a903f5ea..203f9560e 100644
--- a/cmd/podman/containers/list.go
+++ b/cmd/podman/containers/list.go
@@ -4,7 +4,6 @@ import (
"github.com/containers/common/pkg/completion"
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/validate"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/spf13/cobra"
)
@@ -26,7 +25,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: listCmd,
Parent: containerCmd,
})
diff --git a/cmd/podman/containers/logs.go b/cmd/podman/containers/logs.go
index 6275106cf..0d745291e 100644
--- a/cmd/podman/containers/logs.go
+++ b/cmd/podman/containers/logs.go
@@ -77,7 +77,6 @@ func init() {
// logs
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: logsCommand,
})
logsFlags(logsCommand)
@@ -85,7 +84,6 @@ func init() {
// container logs
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: containerLogsCommand,
Parent: containerCmd,
})
diff --git a/cmd/podman/containers/mount.go b/cmd/podman/containers/mount.go
index fd5a279d2..8a7c542ba 100644
--- a/cmd/podman/containers/mount.go
+++ b/cmd/podman/containers/mount.go
@@ -25,6 +25,11 @@ var (
`
mountCommand = &cobra.Command{
+ Annotations: map[string]string{
+ registry.UnshareNSRequired: "",
+ registry.ParentNSRequired: "",
+ registry.EngineMode: registry.ABIMode,
+ },
Use: "mount [options] [CONTAINER...]",
Short: "Mount a working container's root filesystem",
Long: mountDescription,
@@ -32,20 +37,16 @@ var (
Args: func(cmd *cobra.Command, args []string) error {
return validate.CheckAllLatestAndCIDFile(cmd, args, true, false)
},
- Annotations: map[string]string{
- registry.UnshareNSRequired: "",
- registry.ParentNSRequired: "",
- },
ValidArgsFunction: common.AutocompleteContainers,
}
containerMountCommand = &cobra.Command{
+ Annotations: mountCommand.Annotations,
Use: mountCommand.Use,
Short: mountCommand.Short,
Long: mountCommand.Long,
RunE: mountCommand.RunE,
Args: mountCommand.Args,
- Annotations: mountCommand.Annotations,
ValidArgsFunction: mountCommand.ValidArgsFunction,
}
)
@@ -68,14 +69,12 @@ func mountFlags(cmd *cobra.Command) {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode},
Command: mountCommand,
})
mountFlags(mountCommand)
validate.AddLatestFlag(mountCommand, &mountOpts.Latest)
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode},
Command: containerMountCommand,
Parent: containerCmd,
})
diff --git a/cmd/podman/containers/pause.go b/cmd/podman/containers/pause.go
index a1ac00bfb..8e1b69d71 100644
--- a/cmd/podman/containers/pause.go
+++ b/cmd/podman/containers/pause.go
@@ -48,14 +48,12 @@ func pauseFlags(flags *pflag.FlagSet) {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: pauseCommand,
})
flags := pauseCommand.Flags()
pauseFlags(flags)
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: containerPauseCommand,
Parent: containerCmd,
})
diff --git a/cmd/podman/containers/port.go b/cmd/podman/containers/port.go
index 7c9565c26..db66fc9a0 100644
--- a/cmd/podman/containers/port.go
+++ b/cmd/podman/containers/port.go
@@ -56,14 +56,12 @@ func portFlags(flags *pflag.FlagSet) {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: portCommand,
})
portFlags(portCommand.Flags())
validate.AddLatestFlag(portCommand, &portOpts.Latest)
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: containerPortCommand,
Parent: containerCmd,
})
diff --git a/cmd/podman/containers/prune.go b/cmd/podman/containers/prune.go
index 94da029b9..e55bd8a53 100644
--- a/cmd/podman/containers/prune.go
+++ b/cmd/podman/containers/prune.go
@@ -35,7 +35,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: pruneCommand,
Parent: containerCmd,
})
diff --git a/cmd/podman/containers/ps.go b/cmd/podman/containers/ps.go
index 3c0162676..352f67f4e 100644
--- a/cmd/podman/containers/ps.go
+++ b/cmd/podman/containers/ps.go
@@ -60,14 +60,12 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: psCommand,
})
listFlagSet(psCommand)
validate.AddLatestFlag(psCommand, &listOpts.Latest)
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: psContainerCommand,
Parent: containerCmd,
})
diff --git a/cmd/podman/containers/rename.go b/cmd/podman/containers/rename.go
index 0f4a1dde1..1371e50e0 100644
--- a/cmd/podman/containers/rename.go
+++ b/cmd/podman/containers/rename.go
@@ -33,12 +33,10 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: renameCommand,
})
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: containerRenameCommand,
Parent: containerCmd,
})
diff --git a/cmd/podman/containers/restart.go b/cmd/podman/containers/restart.go
index 80ffff700..41b33258f 100644
--- a/cmd/podman/containers/restart.go
+++ b/cmd/podman/containers/restart.go
@@ -39,6 +39,7 @@ var (
Short: restartCommand.Short,
Long: restartCommand.Long,
RunE: restartCommand.RunE,
+ Args: restartCommand.Args,
ValidArgsFunction: restartCommand.ValidArgsFunction,
Example: `podman container restart ctrID
podman container restart --latest
@@ -66,14 +67,12 @@ func restartFlags(cmd *cobra.Command) {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: restartCommand,
})
restartFlags(restartCommand)
validate.AddLatestFlag(restartCommand, &restartOptions.Latest)
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: containerRestartCommand,
Parent: containerCmd,
})
diff --git a/cmd/podman/containers/restore.go b/cmd/podman/containers/restore.go
index ad530e308..3b1848abb 100644
--- a/cmd/podman/containers/restore.go
+++ b/cmd/podman/containers/restore.go
@@ -42,7 +42,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: restoreCommand,
Parent: containerCmd,
})
diff --git a/cmd/podman/containers/rm.go b/cmd/podman/containers/rm.go
index 5822fc4b7..abab71a79 100644
--- a/cmd/podman/containers/rm.go
+++ b/cmd/podman/containers/rm.go
@@ -38,13 +38,11 @@ var (
}
containerRmCommand = &cobra.Command{
- Use: rmCommand.Use,
- Short: rmCommand.Short,
- Long: rmCommand.Long,
- RunE: rmCommand.RunE,
- Args: func(cmd *cobra.Command, args []string) error {
- return validate.CheckAllLatestAndCIDFile(cmd, args, false, true)
- },
+ Use: rmCommand.Use,
+ Short: rmCommand.Short,
+ Long: rmCommand.Long,
+ RunE: rmCommand.RunE,
+ Args: rmCommand.Args,
ValidArgsFunction: rmCommand.ValidArgsFunction,
Example: `podman container rm imageID
podman container rm mywebserver myflaskserver 860a4b23
@@ -79,14 +77,12 @@ func rmFlags(cmd *cobra.Command) {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: rmCommand,
})
rmFlags(rmCommand)
validate.AddLatestFlag(rmCommand, &rmOptions.Latest)
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: containerRmCommand,
Parent: containerCmd,
})
diff --git a/cmd/podman/containers/run.go b/cmd/podman/containers/run.go
index 8e27977c0..2611c5b6e 100644
--- a/cmd/podman/containers/run.go
+++ b/cmd/podman/containers/run.go
@@ -77,6 +77,11 @@ func runFlags(cmd *cobra.Command) {
flags.StringVar(&runOpts.DetachKeys, detachKeysFlagName, containerConfig.DetachKeys(), "Override the key sequence for detaching a container. Format is a single character `[a-Z]` or a comma separated sequence of `ctrl-<value>`, where `<value>` is one of: `a-cf`, `@`, `^`, `[`, `\\`, `]`, `^` or `_`")
_ = cmd.RegisterFlagCompletionFunc(detachKeysFlagName, common.AutocompleteDetachKeys)
+ gpuFlagName := "gpus"
+ flags.String(gpuFlagName, "", "This is a Docker specific option and is a NOOP")
+ _ = cmd.RegisterFlagCompletionFunc(gpuFlagName, completion.AutocompleteNone)
+ _ = flags.MarkHidden("gpus")
+
if registry.IsRemote() {
_ = flags.MarkHidden("preserve-fds")
_ = flags.MarkHidden("conmon-pidfile")
@@ -86,14 +91,12 @@ func runFlags(cmd *cobra.Command) {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: runCommand,
})
runFlags(runCommand)
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: containerRunCommand,
Parent: containerCmd,
})
@@ -204,5 +207,8 @@ func run(cmd *cobra.Command, args []string) error {
logrus.Errorf("%s", errorhandling.JoinErrors(rmErrors))
}
}
+ if cmd.Flag("gpus").Changed {
+ logrus.Info("--gpus is a Docker specific option and is a NOOP")
+ }
return nil
}
diff --git a/cmd/podman/containers/runlabel.go b/cmd/podman/containers/runlabel.go
index 75c2557f0..85f3785be 100644
--- a/cmd/podman/containers/runlabel.go
+++ b/cmd/podman/containers/runlabel.go
@@ -25,6 +25,7 @@ var (
runlabelOptions = runlabelOptionsWrapper{}
runlabelDescription = "Executes a command as described by a container image label."
runlabelCommand = &cobra.Command{
+ Annotations: map[string]string{registry.EngineMode: registry.ABIMode},
Use: "runlabel [options] LABEL IMAGE [ARG...]",
Short: "Execute the command described by an image label",
Long: runlabelDescription,
@@ -39,7 +40,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode},
Command: runlabelCommand,
Parent: containerCmd,
})
diff --git a/cmd/podman/containers/start.go b/cmd/podman/containers/start.go
index dcd1eca82..1163b9093 100644
--- a/cmd/podman/containers/start.go
+++ b/cmd/podman/containers/start.go
@@ -70,14 +70,12 @@ func startFlags(cmd *cobra.Command) {
}
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: startCommand,
})
startFlags(startCommand)
validate.AddLatestFlag(startCommand, &startOptions.Latest)
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: containerStartCommand,
Parent: containerCmd,
})
diff --git a/cmd/podman/containers/stats.go b/cmd/podman/containers/stats.go
index 7160f1ba8..568e410d2 100644
--- a/cmd/podman/containers/stats.go
+++ b/cmd/podman/containers/stats.go
@@ -79,14 +79,12 @@ func statFlags(cmd *cobra.Command) {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: statsCommand,
})
statFlags(statsCommand)
validate.AddLatestFlag(statsCommand, &statsOptions.Latest)
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: containerStatsCommand,
Parent: containerCmd,
})
diff --git a/cmd/podman/containers/stop.go b/cmd/podman/containers/stop.go
index 62ce9b036..13da59a8c 100644
--- a/cmd/podman/containers/stop.go
+++ b/cmd/podman/containers/stop.go
@@ -78,14 +78,12 @@ func stopFlags(cmd *cobra.Command) {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: stopCommand,
})
stopFlags(stopCommand)
validate.AddLatestFlag(stopCommand, &stopOptions.Latest)
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: containerStopCommand,
Parent: containerCmd,
})
diff --git a/cmd/podman/containers/top.go b/cmd/podman/containers/top.go
index 03cee5d56..3fde2e954 100644
--- a/cmd/podman/containers/top.go
+++ b/cmd/podman/containers/top.go
@@ -58,7 +58,6 @@ func topFlags(flags *pflag.FlagSet) {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: topCommand,
})
topFlags(topCommand.Flags())
@@ -71,7 +70,6 @@ func init() {
}
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: containerTopCommand,
Parent: containerCmd,
})
diff --git a/cmd/podman/containers/unmount.go b/cmd/podman/containers/unmount.go
index 98bbce581..96470da78 100644
--- a/cmd/podman/containers/unmount.go
+++ b/cmd/podman/containers/unmount.go
@@ -20,11 +20,12 @@ var (
An unmount can be forced with the --force flag.
`
unmountCommand = &cobra.Command{
- Use: "unmount [options] CONTAINER [CONTAINER...]",
- Aliases: []string{"umount"},
- Short: "Unmounts working container's root filesystem",
- Long: description,
- RunE: unmount,
+ Annotations: map[string]string{registry.EngineMode: registry.ABIMode},
+ Use: "unmount [options] 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)
},
@@ -35,11 +36,12 @@ var (
}
containerUnmountCommand = &cobra.Command{
- Use: unmountCommand.Use,
- Short: unmountCommand.Short,
- Aliases: unmountCommand.Aliases,
- Long: unmountCommand.Long,
- RunE: unmountCommand.RunE,
+ Annotations: unmountCommand.Annotations,
+ 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)
},
@@ -61,14 +63,12 @@ func unmountFlags(flags *pflag.FlagSet) {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode},
Command: unmountCommand,
})
unmountFlags(unmountCommand.Flags())
validate.AddLatestFlag(unmountCommand, &unmountOpts.Latest)
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode},
Command: containerUnmountCommand,
Parent: containerCmd,
})
diff --git a/cmd/podman/containers/unpause.go b/cmd/podman/containers/unpause.go
index 0077181d7..e152f70e1 100644
--- a/cmd/podman/containers/unpause.go
+++ b/cmd/podman/containers/unpause.go
@@ -45,14 +45,12 @@ func unpauseFlags(flags *pflag.FlagSet) {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: unpauseCommand,
})
flags := unpauseCommand.Flags()
unpauseFlags(flags)
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: containerUnpauseCommand,
Parent: containerCmd,
})
diff --git a/cmd/podman/containers/wait.go b/cmd/podman/containers/wait.go
index c01bc08b1..e720421a6 100644
--- a/cmd/podman/containers/wait.go
+++ b/cmd/podman/containers/wait.go
@@ -60,14 +60,12 @@ func waitFlags(cmd *cobra.Command) {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: waitCommand,
})
waitFlags(waitCommand)
validate.AddLatestFlag(waitCommand, &waitOptions.Latest)
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: containerWaitCommand,
Parent: containerCmd,
})
diff --git a/cmd/podman/diff.go b/cmd/podman/diff.go
index ae7d6c4bc..e2a3cd727 100644
--- a/cmd/podman/diff.go
+++ b/cmd/podman/diff.go
@@ -34,7 +34,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: diffCmd,
})
flags := diffCmd.Flags()
diff --git a/cmd/podman/generate/generate.go b/cmd/podman/generate/generate.go
index a6d39bbbe..6b48a342e 100644
--- a/cmd/podman/generate/generate.go
+++ b/cmd/podman/generate/generate.go
@@ -3,7 +3,6 @@ package pods
import (
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/validate"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/util"
"github.com/spf13/cobra"
)
@@ -21,7 +20,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: generateCmd,
})
}
diff --git a/cmd/podman/generate/kube.go b/cmd/podman/generate/kube.go
index 9767b0e06..b4c9f9146 100644
--- a/cmd/podman/generate/kube.go
+++ b/cmd/podman/generate/kube.go
@@ -38,7 +38,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: kubeCmd,
Parent: generateCmd,
})
diff --git a/cmd/podman/generate/systemd.go b/cmd/podman/generate/systemd.go
index 8a8f5016a..5461f1f6a 100644
--- a/cmd/podman/generate/systemd.go
+++ b/cmd/podman/generate/systemd.go
@@ -40,7 +40,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: systemdCmd,
Parent: generateCmd,
})
diff --git a/cmd/podman/healthcheck/healthcheck.go b/cmd/podman/healthcheck/healthcheck.go
index 4a986e171..b42ae2182 100644
--- a/cmd/podman/healthcheck/healthcheck.go
+++ b/cmd/podman/healthcheck/healthcheck.go
@@ -3,12 +3,10 @@ package healthcheck
import (
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/validate"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/spf13/cobra"
)
var (
- // Command: healthcheck
healthCmd = &cobra.Command{
Use: "healthcheck",
Short: "Manage health checks on containers",
@@ -19,7 +17,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: healthCmd,
})
}
diff --git a/cmd/podman/healthcheck/run.go b/cmd/podman/healthcheck/run.go
index 50a51d172..fe8dc2573 100644
--- a/cmd/podman/healthcheck/run.go
+++ b/cmd/podman/healthcheck/run.go
@@ -11,23 +11,20 @@ import (
)
var (
- healthcheckRunDescription = "run the health check of a container"
- healthcheckrunCommand = &cobra.Command{
- Use: "run CONTAINER",
- Short: "run the health check of a container",
- Long: healthcheckRunDescription,
- Example: `podman healthcheck run mywebapp`,
- RunE: run,
- Args: cobra.ExactArgs(1),
- ValidArgsFunction: common.AutocompleteContainersRunning,
- DisableFlagsInUseLine: true,
+ runCmd = &cobra.Command{
+ Use: "run CONTAINER",
+ Short: "run the health check of a container",
+ Long: "run the health check of a container",
+ Example: `podman healthcheck run mywebapp`,
+ RunE: run,
+ Args: cobra.ExactArgs(1),
+ ValidArgsFunction: common.AutocompleteContainersRunning,
}
)
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
- Command: healthcheckrunCommand,
+ Command: runCmd,
Parent: healthCmd,
})
}
diff --git a/cmd/podman/images/build.go b/cmd/podman/images/build.go
index 04fdeab0a..dfb7415a9 100644
--- a/cmd/podman/images/build.go
+++ b/cmd/podman/images/build.go
@@ -82,14 +82,11 @@ func useLayers() string {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
-
Command: buildCmd,
})
buildFlags(buildCmd)
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: imageBuildCmd,
Parent: imageCmd,
})
diff --git a/cmd/podman/images/diff.go b/cmd/podman/images/diff.go
index 7f4c3e83d..2e883d7ae 100644
--- a/cmd/podman/images/diff.go
+++ b/cmd/podman/images/diff.go
@@ -27,7 +27,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: diffCmd,
Parent: imageCmd,
})
diff --git a/cmd/podman/images/exists.go b/cmd/podman/images/exists.go
index 332510b3d..d278eafda 100644
--- a/cmd/podman/images/exists.go
+++ b/cmd/podman/images/exists.go
@@ -3,7 +3,6 @@ package images
import (
"github.com/containers/podman/v3/cmd/podman/common"
"github.com/containers/podman/v3/cmd/podman/registry"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/spf13/cobra"
)
@@ -17,13 +16,11 @@ var (
ValidArgsFunction: common.AutocompleteImages,
Example: `podman image exists ID
podman image exists IMAGE && podman pull IMAGE`,
- DisableFlagsInUseLine: true,
}
)
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: existsCmd,
Parent: imageCmd,
})
diff --git a/cmd/podman/images/history.go b/cmd/podman/images/history.go
index 16be0bb19..69268c261 100644
--- a/cmd/podman/images/history.go
+++ b/cmd/podman/images/history.go
@@ -56,13 +56,11 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: historyCmd,
})
historyFlags(historyCmd)
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: imageHistoryCmd,
Parent: imageCmd,
})
diff --git a/cmd/podman/images/image.go b/cmd/podman/images/image.go
index 69563959d..92d1348bf 100644
--- a/cmd/podman/images/image.go
+++ b/cmd/podman/images/image.go
@@ -3,7 +3,6 @@ package images
import (
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/validate"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/spf13/cobra"
)
@@ -22,7 +21,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: imageCmd,
})
}
diff --git a/cmd/podman/images/images.go b/cmd/podman/images/images.go
deleted file mode 100644
index 17fe21911..000000000
--- a/cmd/podman/images/images.go
+++ /dev/null
@@ -1,32 +0,0 @@
-package images
-
-import (
- "strings"
-
- "github.com/containers/podman/v3/cmd/podman/registry"
- "github.com/containers/podman/v3/pkg/domain/entities"
- "github.com/spf13/cobra"
-)
-
-var (
- // podman _images_ Alias for podman image _list_
- imagesCmd = &cobra.Command{
- Use: strings.Replace(listCmd.Use, "list", "images", 1),
- Args: listCmd.Args,
- Short: listCmd.Short,
- Long: listCmd.Long,
- RunE: listCmd.RunE,
- ValidArgsFunction: listCmd.ValidArgsFunction,
- Example: strings.Replace(listCmd.Example, "podman image list", "podman images", -1),
- DisableFlagsInUseLine: true,
- }
-)
-
-func init() {
- registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
- Command: imagesCmd,
- })
-
- imageListFlagSet(imagesCmd)
-}
diff --git a/cmd/podman/images/import.go b/cmd/podman/images/import.go
index 72e0b63ba..bed2d4105 100644
--- a/cmd/podman/images/import.go
+++ b/cmd/podman/images/import.go
@@ -51,13 +51,11 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: importCommand,
})
importFlags(importCommand)
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: imageImportCommand,
Parent: imageCmd,
})
diff --git a/cmd/podman/images/inspect.go b/cmd/podman/images/inspect.go
index ac3becaa6..35c173a60 100644
--- a/cmd/podman/images/inspect.go
+++ b/cmd/podman/images/inspect.go
@@ -26,7 +26,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: inspectCmd,
Parent: imageCmd,
})
diff --git a/cmd/podman/images/list.go b/cmd/podman/images/list.go
index 132af858b..cc38a45c7 100644
--- a/cmd/podman/images/list.go
+++ b/cmd/podman/images/list.go
@@ -34,8 +34,7 @@ type listFlagType struct {
}
var (
- // Command: podman image _list_
- listCmd = &cobra.Command{
+ imageListCmd = &cobra.Command{
Use: "list [options] [IMAGE]",
Aliases: []string{"ls"},
Args: cobra.MaximumNArgs(1),
@@ -46,7 +45,18 @@ var (
Example: `podman image list --format json
podman image list --sort repository --format "table {{.ID}} {{.Repository}} {{.Tag}}"
podman image list --filter dangling=true`,
- DisableFlagsInUseLine: true,
+ }
+
+ imagesCmd = &cobra.Command{
+ Use: "images [options] [IMAGE]",
+ Args: imageListCmd.Args,
+ Short: imageListCmd.Short,
+ Long: imageListCmd.Long,
+ RunE: imageListCmd.RunE,
+ ValidArgsFunction: imageListCmd.ValidArgsFunction,
+ Example: `podman images --format json
+ podman images --sort repository --format "table {{.ID}} {{.Repository}} {{.Tag}}"
+ podman images --filter dangling=true`,
}
// Options to pull data
@@ -65,11 +75,15 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
- Command: listCmd,
+ Command: imageListCmd,
Parent: imageCmd,
})
- imageListFlagSet(listCmd)
+ imageListFlagSet(imageListCmd)
+
+ registry.Commands = append(registry.Commands, registry.CliCommand{
+ Command: imagesCmd,
+ })
+ imageListFlagSet(imagesCmd)
}
func imageListFlagSet(cmd *cobra.Command) {
diff --git a/cmd/podman/images/load.go b/cmd/podman/images/load.go
index aac95dae8..c7b7d6b3f 100644
--- a/cmd/podman/images/load.go
+++ b/cmd/podman/images/load.go
@@ -45,12 +45,10 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: loadCommand,
})
loadFlags(loadCommand)
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: imageLoadCommand,
Parent: imageCmd,
})
diff --git a/cmd/podman/images/mount.go b/cmd/podman/images/mount.go
index a098aac63..efcff8264 100644
--- a/cmd/podman/images/mount.go
+++ b/cmd/podman/images/mount.go
@@ -24,6 +24,11 @@ var (
`
mountCommand = &cobra.Command{
+ Annotations: map[string]string{
+ registry.UnshareNSRequired: "",
+ registry.ParentNSRequired: "",
+ registry.EngineMode: registry.ABIMode,
+ },
Use: "mount [options] [IMAGE...]",
Short: "Mount an image's root filesystem",
Long: mountDescription,
@@ -33,10 +38,6 @@ var (
podman image mount imgID1 imgID2 imgID3
podman image mount
podman image mount --all`,
- Annotations: map[string]string{
- registry.UnshareNSRequired: "",
- registry.ParentNSRequired: "",
- },
}
)
@@ -56,7 +57,6 @@ func mountFlags(cmd *cobra.Command) {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode},
Command: mountCommand,
Parent: imageCmd,
})
diff --git a/cmd/podman/images/prune.go b/cmd/podman/images/prune.go
index db645cc2e..a082255f6 100644
--- a/cmd/podman/images/prune.go
+++ b/cmd/podman/images/prune.go
@@ -34,7 +34,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: pruneCmd,
Parent: imageCmd,
})
diff --git a/cmd/podman/images/pull.go b/cmd/podman/images/pull.go
index bf0eec759..a831ea848 100644
--- a/cmd/podman/images/pull.go
+++ b/cmd/podman/images/pull.go
@@ -60,14 +60,12 @@ var (
func init() {
// pull
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: pullCmd,
})
pullFlags(pullCmd)
// images pull
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: imagesPullCmd,
Parent: imageCmd,
})
diff --git a/cmd/podman/images/push.go b/cmd/podman/images/push.go
index 9e7b447a4..edf8e9203 100644
--- a/cmd/podman/images/push.go
+++ b/cmd/podman/images/push.go
@@ -57,14 +57,12 @@ var (
func init() {
// push
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: pushCmd,
})
pushFlags(pushCmd)
// images push
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: imagePushCmd,
Parent: imageCmd,
})
diff --git a/cmd/podman/images/rm.go b/cmd/podman/images/rm.go
index 2daa4743f..be4c0b883 100644
--- a/cmd/podman/images/rm.go
+++ b/cmd/podman/images/rm.go
@@ -25,17 +25,33 @@ var (
podman image rm c4dfb1609ee2 93fd78260bd1 c0ed59d05ff7`,
}
+ rmiCmd = &cobra.Command{
+ Use: "rmi [options] IMAGE [IMAGE...]",
+ Args: rmCmd.Args,
+ Short: rmCmd.Short,
+ Long: rmCmd.Long,
+ RunE: rmCmd.RunE,
+ ValidArgsFunction: rmCmd.ValidArgsFunction,
+ Example: `podman rmi imageID
+ podman rmi --force alpine
+ podman rmi c4dfb1609ee2 93fd78260bd1 c0ed59d05ff7`,
+ }
+
imageOpts = entities.ImageRemoveOptions{}
)
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: rmCmd,
Parent: imageCmd,
})
imageRemoveFlagSet(rmCmd.Flags())
+
+ registry.Commands = append(registry.Commands, registry.CliCommand{
+ Command: rmiCmd,
+ })
+ imageRemoveFlagSet(rmiCmd.Flags())
}
func imageRemoveFlagSet(flags *pflag.FlagSet) {
diff --git a/cmd/podman/images/rmi.go b/cmd/podman/images/rmi.go
deleted file mode 100644
index edd6ae96f..000000000
--- a/cmd/podman/images/rmi.go
+++ /dev/null
@@ -1,29 +0,0 @@
-package images
-
-import (
- "strings"
-
- "github.com/containers/podman/v3/cmd/podman/registry"
- "github.com/containers/podman/v3/pkg/domain/entities"
- "github.com/spf13/cobra"
-)
-
-var (
- rmiCmd = &cobra.Command{
- Use: strings.Replace(rmCmd.Use, "rm ", "rmi ", 1),
- Args: rmCmd.Args,
- Short: rmCmd.Short,
- Long: rmCmd.Long,
- RunE: rmCmd.RunE,
- ValidArgsFunction: rmCmd.ValidArgsFunction,
- Example: strings.Replace(rmCmd.Example, "podman image rm", "podman rmi", -1),
- }
-)
-
-func init() {
- registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
- Command: rmiCmd,
- })
- imageRemoveFlagSet(rmiCmd.Flags())
-}
diff --git a/cmd/podman/images/save.go b/cmd/podman/images/save.go
index f1f7e8b2e..19dadb2ad 100644
--- a/cmd/podman/images/save.go
+++ b/cmd/podman/images/save.go
@@ -48,6 +48,7 @@ var (
podman save --format docker-dir -o ubuntu-dir ubuntu
podman save > alpine-all.tar alpine:latest`,
}
+
imageSaveCommand = &cobra.Command{
Args: saveCommand.Args,
Use: saveCommand.Use,
@@ -67,13 +68,11 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: saveCommand,
})
saveFlags(saveCommand)
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: imageSaveCommand,
Parent: imageCmd,
})
diff --git a/cmd/podman/images/search.go b/cmd/podman/images/search.go
index a3cfa983f..08bf3cf6b 100644
--- a/cmd/podman/images/search.go
+++ b/cmd/podman/images/search.go
@@ -38,7 +38,6 @@ var (
Users can limit the number of results, and filter the output based on certain conditions.`
- // Command: podman search
searchCmd = &cobra.Command{
Use: "search [options] TERM",
Short: "Search registry for image",
@@ -51,14 +50,12 @@ var (
podman search --format "table {{.Index}} {{.Name}}" registry.fedoraproject.org/fedora`,
}
- // Command: podman image search
imageSearchCmd = &cobra.Command{
Use: searchCmd.Use,
Short: searchCmd.Short,
Long: searchCmd.Long,
RunE: searchCmd.RunE,
Args: searchCmd.Args,
- Annotations: searchCmd.Annotations,
ValidArgsFunction: searchCmd.ValidArgsFunction,
Example: `podman image search --filter=is-official --limit 3 alpine
podman image search registry.fedoraproject.org/ # only works with v2 registries
@@ -67,16 +64,12 @@ var (
)
func init() {
- // search
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: searchCmd,
})
searchFlags(searchCmd)
- // images search
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: imageSearchCmd,
Parent: imageCmd,
})
diff --git a/cmd/podman/images/sign.go b/cmd/podman/images/sign.go
index fcd904bb7..96f214d0b 100644
--- a/cmd/podman/images/sign.go
+++ b/cmd/podman/images/sign.go
@@ -14,6 +14,7 @@ import (
var (
signDescription = "Create a signature file that can be used later to verify the image."
signCommand = &cobra.Command{
+ Annotations: map[string]string{registry.EngineMode: registry.ABIMode},
Use: "sign [options] IMAGE [IMAGE...]",
Short: "Sign an image",
Long: signDescription,
@@ -31,7 +32,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode},
Command: signCommand,
Parent: imageCmd,
})
diff --git a/cmd/podman/images/tag.go b/cmd/podman/images/tag.go
index 695ca30ed..633368f50 100644
--- a/cmd/podman/images/tag.go
+++ b/cmd/podman/images/tag.go
@@ -10,26 +10,24 @@ import (
var (
tagDescription = "Adds one or more additional names to locally-stored image."
tagCommand = &cobra.Command{
- Use: "tag IMAGE TARGET_NAME [TARGET_NAME...]",
- Short: "Add an additional name to a local image",
- Long: tagDescription,
- RunE: tag,
- Args: cobra.MinimumNArgs(2),
- DisableFlagsInUseLine: true,
- ValidArgsFunction: common.AutocompleteImages,
+ Use: "tag IMAGE TARGET_NAME [TARGET_NAME...]",
+ Short: "Add an additional name to a local image",
+ Long: tagDescription,
+ RunE: tag,
+ Args: cobra.MinimumNArgs(2),
+ ValidArgsFunction: common.AutocompleteImages,
Example: `podman tag 0e3bbc2 fedora:latest
podman tag imageID:latest myNewImage:newTag
podman tag httpd myregistryhost:5000/fedora/httpd:v2`,
}
imageTagCommand = &cobra.Command{
- Args: tagCommand.Args,
- DisableFlagsInUseLine: true,
- Use: tagCommand.Use,
- Short: tagCommand.Short,
- Long: tagCommand.Long,
- RunE: tagCommand.RunE,
- ValidArgsFunction: tagCommand.ValidArgsFunction,
+ Args: tagCommand.Args,
+ Use: tagCommand.Use,
+ Short: tagCommand.Short,
+ Long: tagCommand.Long,
+ RunE: tagCommand.RunE,
+ ValidArgsFunction: tagCommand.ValidArgsFunction,
Example: `podman image tag 0e3bbc2 fedora:latest
podman image tag imageID:latest myNewImage:newTag
podman image tag httpd myregistryhost:5000/fedora/httpd:v2`,
@@ -38,11 +36,9 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: tagCommand,
})
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: imageTagCommand,
Parent: imageCmd,
})
diff --git a/cmd/podman/images/tree.go b/cmd/podman/images/tree.go
index 0a659c914..8ace9d63c 100644
--- a/cmd/podman/images/tree.go
+++ b/cmd/podman/images/tree.go
@@ -25,7 +25,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: treeCmd,
Parent: imageCmd,
})
diff --git a/cmd/podman/images/trust.go b/cmd/podman/images/trust.go
index 2c51bb5f8..28eb53193 100644
--- a/cmd/podman/images/trust.go
+++ b/cmd/podman/images/trust.go
@@ -3,7 +3,6 @@ package images
import (
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/validate"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/spf13/cobra"
)
@@ -11,16 +10,16 @@ var (
trustDescription = `Manages which registries you trust as a source of container images based on their location.
The location is determined by the transport and the registry host of the image. Using this container image docker://quay.io/podman/stable as an example, docker is the transport and quay.io is the registry host.`
trustCmd = &cobra.Command{
- Use: "trust",
- Short: "Manage container image trust policy",
- Long: trustDescription,
- RunE: validate.SubCommandExists,
+ Annotations: map[string]string{registry.EngineMode: registry.ABIMode},
+ Use: "trust",
+ Short: "Manage container image trust policy",
+ Long: trustDescription,
+ RunE: validate.SubCommandExists,
}
)
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode},
Command: trustCmd,
Parent: imageCmd,
})
diff --git a/cmd/podman/images/trust_set.go b/cmd/podman/images/trust_set.go
index c192669a9..e01a04146 100644
--- a/cmd/podman/images/trust_set.go
+++ b/cmd/podman/images/trust_set.go
@@ -16,6 +16,7 @@ import (
var (
setTrustDescription = "Set default trust policy or add a new trust policy for a registry"
setTrustCommand = &cobra.Command{
+ Annotations: map[string]string{registry.EngineMode: registry.ABIMode},
Use: "set [options] REGISTRY",
Short: "Set default trust policy or a new trust policy for a registry",
Long: setTrustDescription,
@@ -32,7 +33,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode},
Command: setTrustCommand,
Parent: trustCmd,
})
diff --git a/cmd/podman/images/trust_show.go b/cmd/podman/images/trust_show.go
index ed9aecdb7..5d9376068 100644
--- a/cmd/podman/images/trust_show.go
+++ b/cmd/podman/images/trust_show.go
@@ -15,6 +15,7 @@ import (
var (
showTrustDescription = "Display trust policy for the system"
showTrustCommand = &cobra.Command{
+ Annotations: map[string]string{registry.EngineMode: registry.ABIMode},
Use: "show [options] [REGISTRY]",
Short: "Display trust policy for the system",
Long: showTrustDescription,
@@ -31,7 +32,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode},
Command: showTrustCommand,
Parent: trustCmd,
})
diff --git a/cmd/podman/images/unmount.go b/cmd/podman/images/unmount.go
index 1e890c292..f72268ea2 100644
--- a/cmd/podman/images/unmount.go
+++ b/cmd/podman/images/unmount.go
@@ -20,6 +20,7 @@ var (
An unmount can be forced with the --force flag.
`
unmountCommand = &cobra.Command{
+ Annotations: map[string]string{registry.EngineMode: registry.ABIMode},
Use: "unmount [options] IMAGE [IMAGE...]",
Aliases: []string{"umount"},
Short: "Unmount an image's root filesystem",
@@ -43,7 +44,6 @@ func unmountFlags(flags *pflag.FlagSet) {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode},
Parent: imageCmd,
Command: unmountCommand,
})
diff --git a/cmd/podman/images/untag.go b/cmd/podman/images/untag.go
index 4344e1847..4c1862242 100644
--- a/cmd/podman/images/untag.go
+++ b/cmd/podman/images/untag.go
@@ -8,27 +8,25 @@ import (
)
var (
- untagCommand = &cobra.Command{
- Use: "untag IMAGE [IMAGE...]",
- Short: "Remove a name from a local image",
- Long: "Removes one or more names from a locally-stored image.",
- RunE: untag,
- Args: cobra.MinimumNArgs(1),
- DisableFlagsInUseLine: true,
- ValidArgsFunction: common.AutocompleteImages,
+ untagCmd = &cobra.Command{
+ Use: "untag IMAGE [IMAGE...]",
+ Short: "Remove a name from a local image",
+ Long: "Removes one or more names from a locally-stored image.",
+ RunE: untag,
+ Args: cobra.MinimumNArgs(1),
+ ValidArgsFunction: common.AutocompleteImages,
Example: `podman untag 0e3bbc2
podman untag imageID:latest otherImageName:latest
podman untag httpd myregistryhost:5000/fedora/httpd:v2`,
}
- imageUntagCommand = &cobra.Command{
- Args: untagCommand.Args,
- DisableFlagsInUseLine: true,
- Use: untagCommand.Use,
- Short: untagCommand.Short,
- Long: untagCommand.Long,
- RunE: untagCommand.RunE,
- ValidArgsFunction: untagCommand.ValidArgsFunction,
+ imageUntagCmd = &cobra.Command{
+ Args: untagCmd.Args,
+ Use: untagCmd.Use,
+ Short: untagCmd.Short,
+ Long: untagCmd.Long,
+ RunE: untagCmd.RunE,
+ ValidArgsFunction: untagCmd.ValidArgsFunction,
Example: `podman image untag 0e3bbc2
podman image untag imageID:latest otherImageName:latest
podman image untag httpd myregistryhost:5000/fedora/httpd:v2`,
@@ -37,12 +35,10 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
- Command: untagCommand,
+ Command: untagCmd,
})
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
- Command: imageUntagCommand,
+ Command: imageUntagCmd,
Parent: imageCmd,
})
}
diff --git a/cmd/podman/inspect.go b/cmd/podman/inspect.go
index 13417c1ab..0c8102952 100644
--- a/cmd/podman/inspect.go
+++ b/cmd/podman/inspect.go
@@ -36,7 +36,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: inspectCmd,
})
inspectOpts = inspect.AddInspectFlagSet(inspectCmd)
diff --git a/cmd/podman/login.go b/cmd/podman/login.go
index cd3bc9756..2101e32e2 100644
--- a/cmd/podman/login.go
+++ b/cmd/podman/login.go
@@ -9,7 +9,6 @@ import (
"github.com/containers/image/v5/types"
"github.com/containers/podman/v3/cmd/podman/common"
"github.com/containers/podman/v3/cmd/podman/registry"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/registries"
"github.com/spf13/cobra"
)
@@ -39,7 +38,6 @@ func init() {
// store credentials locally while the remote client will pass them
// over the wire to the endpoint.
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: loginCommand,
})
flags := loginCommand.Flags()
diff --git a/cmd/podman/logout.go b/cmd/podman/logout.go
index 286737b12..092ad2610 100644
--- a/cmd/podman/logout.go
+++ b/cmd/podman/logout.go
@@ -8,7 +8,6 @@ import (
"github.com/containers/image/v5/types"
"github.com/containers/podman/v3/cmd/podman/common"
"github.com/containers/podman/v3/cmd/podman/registry"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/registries"
"github.com/spf13/cobra"
)
@@ -33,7 +32,6 @@ func init() {
// store credentials locally while the remote client will pass them
// over the wire to the endpoint.
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: logoutCommand,
})
flags := logoutCommand.Flags()
diff --git a/cmd/podman/machine/init.go b/cmd/podman/machine/init.go
index 02dfc80aa..f4133dbde 100644
--- a/cmd/podman/machine/init.go
+++ b/cmd/podman/machine/init.go
@@ -5,7 +5,6 @@ package machine
import (
"github.com/containers/common/pkg/completion"
"github.com/containers/podman/v3/cmd/podman/registry"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/machine"
"github.com/containers/podman/v3/pkg/machine/qemu"
"github.com/pkg/errors"
@@ -25,13 +24,12 @@ var (
)
var (
- initOpts = machine.InitOptions{}
- defaultMachineName string = "podman-machine-default"
+ initOpts = machine.InitOptions{}
+ defaultMachineName = "podman-machine-default"
)
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: initCmd,
Parent: machineCmd,
})
diff --git a/cmd/podman/machine/list.go b/cmd/podman/machine/list.go
index af4e2c807..77b47161a 100644
--- a/cmd/podman/machine/list.go
+++ b/cmd/podman/machine/list.go
@@ -15,7 +15,6 @@ import (
"github.com/containers/podman/v3/cmd/podman/parse"
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/validate"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/machine"
"github.com/containers/podman/v3/pkg/machine/qemu"
"github.com/docker/go-units"
@@ -25,15 +24,15 @@ import (
var (
lsCmd = &cobra.Command{
- Use: "list [options]",
- Aliases: []string{"ls"},
- Short: "List machines",
- Long: "List managed virtual machines.",
- RunE: list,
- Args: validate.NoArgs,
+ Use: "list [options]",
+ Aliases: []string{"ls"},
+ Short: "List machines",
+ Long: "List managed virtual machines.",
+ RunE: list,
+ Args: validate.NoArgs,
+ ValidArgsFunction: completion.AutocompleteNone,
Example: `podman machine list,
podman machine ls`,
- ValidArgsFunction: completion.AutocompleteNone,
}
listFlag = listFlagType{}
)
@@ -52,7 +51,6 @@ type machineReporter struct {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: lsCmd,
Parent: machineCmd,
})
diff --git a/cmd/podman/machine/machine.go b/cmd/podman/machine/machine.go
index d8cdf5568..b059afc38 100644
--- a/cmd/podman/machine/machine.go
+++ b/cmd/podman/machine/machine.go
@@ -7,7 +7,6 @@ import (
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/validate"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/machine"
"github.com/containers/podman/v3/pkg/machine/qemu"
"github.com/spf13/cobra"
@@ -30,7 +29,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: machineCmd,
})
}
diff --git a/cmd/podman/machine/machine_unsupported.go b/cmd/podman/machine/machine_unsupported.go
index 3bb44b51f..f8392694a 100644
--- a/cmd/podman/machine/machine_unsupported.go
+++ b/cmd/podman/machine/machine_unsupported.go
@@ -2,4 +2,5 @@
package machine
+// init do not register _podman machine_ command on unsupported platforms
func init() {}
diff --git a/cmd/podman/machine/rm.go b/cmd/podman/machine/rm.go
index 0be2ba40c..02e3dfeb8 100644
--- a/cmd/podman/machine/rm.go
+++ b/cmd/podman/machine/rm.go
@@ -9,7 +9,6 @@ import (
"strings"
"github.com/containers/podman/v3/cmd/podman/registry"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/machine"
"github.com/containers/podman/v3/pkg/machine/qemu"
"github.com/spf13/cobra"
@@ -33,7 +32,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: rmCmd,
Parent: machineCmd,
})
diff --git a/cmd/podman/machine/ssh.go b/cmd/podman/machine/ssh.go
index ecc6d3b82..b52a48faf 100644
--- a/cmd/podman/machine/ssh.go
+++ b/cmd/podman/machine/ssh.go
@@ -4,7 +4,6 @@ package machine
import (
"github.com/containers/podman/v3/cmd/podman/registry"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/machine"
"github.com/containers/podman/v3/pkg/machine/qemu"
"github.com/pkg/errors"
@@ -30,7 +29,6 @@ var (
func init() {
sshCmd.Flags().SetInterspersed(false)
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: sshCmd,
Parent: machineCmd,
})
diff --git a/cmd/podman/machine/start.go b/cmd/podman/machine/start.go
index 4334cfc0f..f8f0eed09 100644
--- a/cmd/podman/machine/start.go
+++ b/cmd/podman/machine/start.go
@@ -4,7 +4,6 @@ package machine
import (
"github.com/containers/podman/v3/cmd/podman/registry"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/machine"
"github.com/containers/podman/v3/pkg/machine/qemu"
"github.com/pkg/errors"
@@ -25,7 +24,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: startCmd,
Parent: machineCmd,
})
diff --git a/cmd/podman/machine/stop.go b/cmd/podman/machine/stop.go
index 4307d3eeb..2d5aa7b95 100644
--- a/cmd/podman/machine/stop.go
+++ b/cmd/podman/machine/stop.go
@@ -4,7 +4,6 @@ package machine
import (
"github.com/containers/podman/v3/cmd/podman/registry"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/machine"
"github.com/containers/podman/v3/pkg/machine/qemu"
"github.com/spf13/cobra"
@@ -24,7 +23,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: stopCmd,
Parent: machineCmd,
})
diff --git a/cmd/podman/main.go b/cmd/podman/main.go
index 5219da26d..b7f5f1720 100644
--- a/cmd/podman/main.go
+++ b/cmd/podman/main.go
@@ -3,6 +3,7 @@ package main
import (
"fmt"
"os"
+ "strings"
_ "github.com/containers/podman/v3/cmd/podman/completion"
_ "github.com/containers/podman/v3/cmd/podman/containers"
@@ -42,38 +43,41 @@ func main() {
func parseCommands() *cobra.Command {
cfg := registry.PodmanConfig()
for _, c := range registry.Commands {
- for _, m := range c.Mode {
- if cfg.EngineMode == m {
- // Command cannot be run rootless
- _, 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())
- }
- }
+ if supported, found := c.Command.Annotations[registry.EngineMode]; found {
+ if !strings.Contains(cfg.EngineMode.String(), supported) {
+ continue
+ }
+ }
+
+ // Command cannot be run rootless
+ _, found := c.Command.Annotations[registry.UnshareNSRequired]
+ if found {
+ if rootless.IsRootless() && 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())
}
- parent := rootCmd
- if c.Parent != nil {
- parent = c.Parent
+ }
+ } 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.AddCommand(c.Command)
-
- // - templates need to be set here, as PersistentPreRunE() is
- // not called when --help is used.
- // - rootCmd uses cobra default template not ours
- c.Command.SetHelpTemplate(helpTemplate)
- c.Command.SetUsageTemplate(usageTemplate)
- c.Command.DisableFlagsInUseLine = true
}
}
+
+ parent := rootCmd
+ if c.Parent != nil {
+ parent = c.Parent
+ }
+ parent.AddCommand(c.Command)
+
+ // - templates need to be set here, as PersistentPreRunE() is
+ // not called when --help is used.
+ // - rootCmd uses cobra default template not ours
+ c.Command.SetHelpTemplate(helpTemplate)
+ c.Command.SetUsageTemplate(usageTemplate)
+ c.Command.DisableFlagsInUseLine = true
}
if err := terminal.SetConsole(); err != nil {
logrus.Error(err)
diff --git a/cmd/podman/manifest/add.go b/cmd/podman/manifest/add.go
index 2499dc2e8..9d219601c 100644
--- a/cmd/podman/manifest/add.go
+++ b/cmd/podman/manifest/add.go
@@ -39,7 +39,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: addCmd,
Parent: manifestCmd,
})
diff --git a/cmd/podman/manifest/annotate.go b/cmd/podman/manifest/annotate.go
index f5ec13bf2..d806ce9e6 100644
--- a/cmd/podman/manifest/annotate.go
+++ b/cmd/podman/manifest/annotate.go
@@ -15,6 +15,7 @@ import (
var (
manifestAnnotateOpts = entities.ManifestAnnotateOptions{}
annotateCmd = &cobra.Command{
+ Annotations: map[string]string{registry.EngineMode: registry.ABIMode},
Use: "annotate [options] LIST IMAGE",
Short: "Add or update information about an entry in a manifest list or image index",
Long: "Adds or updates information about an entry in a manifest list or image index.",
@@ -27,7 +28,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode},
Command: annotateCmd,
Parent: manifestCmd,
})
diff --git a/cmd/podman/manifest/create.go b/cmd/podman/manifest/create.go
index a15b129d5..9f7d74d14 100644
--- a/cmd/podman/manifest/create.go
+++ b/cmd/podman/manifest/create.go
@@ -27,7 +27,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: createCmd,
Parent: manifestCmd,
})
diff --git a/cmd/podman/manifest/exists.go b/cmd/podman/manifest/exists.go
index 7fed1f25c..55318330d 100644
--- a/cmd/podman/manifest/exists.go
+++ b/cmd/podman/manifest/exists.go
@@ -3,7 +3,6 @@ package manifest
import (
"github.com/containers/podman/v3/cmd/podman/common"
"github.com/containers/podman/v3/cmd/podman/registry"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/spf13/cobra"
)
@@ -21,7 +20,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: existsCmd,
Parent: manifestCmd,
})
diff --git a/cmd/podman/manifest/inspect.go b/cmd/podman/manifest/inspect.go
index 118c0ae70..d444f9066 100644
--- a/cmd/podman/manifest/inspect.go
+++ b/cmd/podman/manifest/inspect.go
@@ -6,26 +6,23 @@ import (
"github.com/containers/podman/v3/cmd/podman/common"
"github.com/containers/podman/v3/cmd/podman/registry"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/spf13/cobra"
)
var (
inspectCmd = &cobra.Command{
- Use: "inspect IMAGE",
- Short: "Display the contents of a manifest list or image index",
- Long: "Display the contents of a manifest list or image index.",
- RunE: inspect,
- ValidArgsFunction: common.AutocompleteImages,
- Example: "podman manifest inspect localhost/list",
- Args: cobra.ExactArgs(1),
- DisableFlagsInUseLine: true,
+ Use: "inspect IMAGE",
+ Short: "Display the contents of a manifest list or image index",
+ Long: "Display the contents of a manifest list or image index.",
+ RunE: inspect,
+ ValidArgsFunction: common.AutocompleteImages,
+ Example: "podman manifest inspect localhost/list",
+ Args: cobra.ExactArgs(1),
}
)
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: inspectCmd,
Parent: manifestCmd,
})
diff --git a/cmd/podman/manifest/manifest.go b/cmd/podman/manifest/manifest.go
index c725078bf..98d5199f1 100644
--- a/cmd/podman/manifest/manifest.go
+++ b/cmd/podman/manifest/manifest.go
@@ -3,7 +3,6 @@ package manifest
import (
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/validate"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/spf13/cobra"
)
@@ -26,7 +25,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: manifestCmd,
})
}
diff --git a/cmd/podman/manifest/push.go b/cmd/podman/manifest/push.go
index 1dae5cc95..8b13f6dde 100644
--- a/cmd/podman/manifest/push.go
+++ b/cmd/podman/manifest/push.go
@@ -39,7 +39,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: pushCmd,
Parent: manifestCmd,
})
diff --git a/cmd/podman/manifest/remove.go b/cmd/podman/manifest/remove.go
index 1d1128166..c44c0991e 100644
--- a/cmd/podman/manifest/remove.go
+++ b/cmd/podman/manifest/remove.go
@@ -6,27 +6,24 @@ import (
"github.com/containers/podman/v3/cmd/podman/common"
"github.com/containers/podman/v3/cmd/podman/registry"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
var (
removeCmd = &cobra.Command{
- Use: "remove LIST IMAGE",
- Short: "Remove an entry from a manifest list or image index",
- Long: "Removes an image from a manifest list or image index.",
- RunE: remove,
- ValidArgsFunction: common.AutocompleteImages,
- Example: `podman manifest remove mylist:v1.11 sha256:15352d97781ffdf357bf3459c037be3efac4133dc9070c2dce7eca7c05c3e736`,
- Args: cobra.ExactArgs(2),
- DisableFlagsInUseLine: true,
+ Use: "remove LIST IMAGE",
+ Short: "Remove an entry from a manifest list or image index",
+ Long: "Removes an image from a manifest list or image index.",
+ RunE: remove,
+ ValidArgsFunction: common.AutocompleteImages,
+ Example: `podman manifest remove mylist:v1.11 sha256:15352d97781ffdf357bf3459c037be3efac4133dc9070c2dce7eca7c05c3e736`,
+ Args: cobra.ExactArgs(2),
}
)
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: removeCmd,
Parent: manifestCmd,
})
diff --git a/cmd/podman/manifest/rm.go b/cmd/podman/manifest/rm.go
index 58c0de886..5e78197ed 100644
--- a/cmd/podman/manifest/rm.go
+++ b/cmd/podman/manifest/rm.go
@@ -6,27 +6,24 @@ import (
"github.com/containers/podman/v3/cmd/podman/common"
"github.com/containers/podman/v3/cmd/podman/registry"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/errorhandling"
"github.com/spf13/cobra"
)
var (
rmCmd = &cobra.Command{
- Use: "rm LIST",
- Short: "Remove manifest list or image index from local storage",
- Long: "Remove manifest list or image index from local storage.",
- RunE: rm,
- ValidArgsFunction: common.AutocompleteImages,
- Example: `podman manifest rm mylist:v1.11`,
- Args: cobra.ExactArgs(1),
- DisableFlagsInUseLine: true,
+ Use: "rm LIST",
+ Short: "Remove manifest list or image index from local storage",
+ Long: "Remove manifest list or image index from local storage.",
+ RunE: rm,
+ ValidArgsFunction: common.AutocompleteImages,
+ Example: `podman manifest rm mylist:v1.11`,
+ Args: cobra.ExactArgs(1),
}
)
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: rmCmd,
Parent: manifestCmd,
})
diff --git a/cmd/podman/networks/connect.go b/cmd/podman/networks/connect.go
index 9fa088b78..0d62a45df 100644
--- a/cmd/podman/networks/connect.go
+++ b/cmd/podman/networks/connect.go
@@ -34,7 +34,6 @@ func networkConnectFlags(cmd *cobra.Command) {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: networkConnectCommand,
Parent: networkCmd,
})
diff --git a/cmd/podman/networks/create.go b/cmd/podman/networks/create.go
index 64ca2464a..1f3b321ba 100644
--- a/cmd/podman/networks/create.go
+++ b/cmd/podman/networks/create.go
@@ -75,7 +75,6 @@ func networkCreateFlags(cmd *cobra.Command) {
}
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: networkCreateCommand,
Parent: networkCmd,
})
diff --git a/cmd/podman/networks/disconnect.go b/cmd/podman/networks/disconnect.go
index 26861eec6..7f2ff4252 100644
--- a/cmd/podman/networks/disconnect.go
+++ b/cmd/podman/networks/disconnect.go
@@ -31,7 +31,6 @@ func networkDisconnectFlags(flags *pflag.FlagSet) {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: networkDisconnectCommand,
Parent: networkCmd,
})
diff --git a/cmd/podman/networks/exists.go b/cmd/podman/networks/exists.go
index fdbd0ef11..89466ab7f 100644
--- a/cmd/podman/networks/exists.go
+++ b/cmd/podman/networks/exists.go
@@ -3,7 +3,6 @@ package network
import (
"github.com/containers/podman/v3/cmd/podman/common"
"github.com/containers/podman/v3/cmd/podman/registry"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/spf13/cobra"
)
@@ -22,7 +21,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: networkExistsCommand,
Parent: networkCmd,
})
diff --git a/cmd/podman/networks/inspect.go b/cmd/podman/networks/inspect.go
index a05b9026d..c0e5b9720 100644
--- a/cmd/podman/networks/inspect.go
+++ b/cmd/podman/networks/inspect.go
@@ -24,7 +24,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: networkinspectCommand,
Parent: networkCmd,
})
diff --git a/cmd/podman/networks/list.go b/cmd/podman/networks/list.go
index e1b182cbf..46872d078 100644
--- a/cmd/podman/networks/list.go
+++ b/cmd/podman/networks/list.go
@@ -54,7 +54,6 @@ func networkListFlags(flags *pflag.FlagSet) {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: networklistCommand,
Parent: networkCmd,
})
diff --git a/cmd/podman/networks/network.go b/cmd/podman/networks/network.go
index 4d6cd8abd..ec045e3cf 100644
--- a/cmd/podman/networks/network.go
+++ b/cmd/podman/networks/network.go
@@ -3,7 +3,6 @@ package network
import (
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/validate"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/spf13/cobra"
)
@@ -22,7 +21,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: networkCmd,
})
}
diff --git a/cmd/podman/networks/prune.go b/cmd/podman/networks/prune.go
index 5f1cbda5f..e6b779ded 100644
--- a/cmd/podman/networks/prune.go
+++ b/cmd/podman/networks/prune.go
@@ -43,7 +43,6 @@ func networkPruneFlags(cmd *cobra.Command, flags *pflag.FlagSet) {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: networkPruneCommand,
Parent: networkCmd,
})
diff --git a/cmd/podman/networks/reload.go b/cmd/podman/networks/reload.go
index 035e56a07..371bea9ef 100644
--- a/cmd/podman/networks/reload.go
+++ b/cmd/podman/networks/reload.go
@@ -15,10 +15,11 @@ import (
var (
networkReloadDescription = `reload container networks, recreating firewall rules`
networkReloadCommand = &cobra.Command{
- Use: "reload [options] [CONTAINER...]",
- Short: "Reload firewall rules for one or more containers",
- Long: networkReloadDescription,
- RunE: networkReload,
+ Annotations: map[string]string{registry.EngineMode: registry.ABIMode},
+ Use: "reload [options] [CONTAINER...]",
+ Short: "Reload firewall rules for one or more containers",
+ Long: networkReloadDescription,
+ RunE: networkReload,
Args: func(cmd *cobra.Command, args []string) error {
return validate.CheckAllLatestAndCIDFile(cmd, args, false, false)
},
@@ -39,7 +40,6 @@ func reloadFlags(flags *pflag.FlagSet) {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode},
Command: networkReloadCommand,
Parent: networkCmd,
})
diff --git a/cmd/podman/networks/rm.go b/cmd/podman/networks/rm.go
index 1ae79b27d..14f9869e4 100644
--- a/cmd/podman/networks/rm.go
+++ b/cmd/podman/networks/rm.go
@@ -38,7 +38,6 @@ func networkRmFlags(flags *pflag.FlagSet) {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: networkrmCommand,
Parent: networkCmd,
})
diff --git a/cmd/podman/play/kube.go b/cmd/podman/play/kube.go
index fe382bdfb..ece7d1f98 100644
--- a/cmd/podman/play/kube.go
+++ b/cmd/podman/play/kube.go
@@ -51,7 +51,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: kubeCmd,
Parent: playCmd,
})
diff --git a/cmd/podman/play/play.go b/cmd/podman/play/play.go
index 89c7e0139..f121d6a2d 100644
--- a/cmd/podman/play/play.go
+++ b/cmd/podman/play/play.go
@@ -3,7 +3,6 @@ package pods
import (
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/validate"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/spf13/cobra"
)
@@ -19,7 +18,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: playCmd,
})
}
diff --git a/cmd/podman/pods/create.go b/cmd/podman/pods/create.go
index 5600d8794..3c2c8a3bc 100644
--- a/cmd/podman/pods/create.go
+++ b/cmd/podman/pods/create.go
@@ -47,7 +47,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: createCommand,
Parent: podCmd,
})
diff --git a/cmd/podman/pods/exists.go b/cmd/podman/pods/exists.go
index a9ef0370b..c4e64f88e 100644
--- a/cmd/podman/pods/exists.go
+++ b/cmd/podman/pods/exists.go
@@ -5,7 +5,6 @@ import (
"github.com/containers/podman/v3/cmd/podman/common"
"github.com/containers/podman/v3/cmd/podman/registry"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/spf13/cobra"
)
@@ -21,13 +20,11 @@ var (
ValidArgsFunction: common.AutocompletePods,
Example: `podman pod exists podID
podman pod exists mypod || podman pod create --name mypod`,
- DisableFlagsInUseLine: true,
}
)
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: existsCommand,
Parent: podCmd,
})
diff --git a/cmd/podman/pods/inspect.go b/cmd/podman/pods/inspect.go
index c66b81adb..d38f0062c 100644
--- a/cmd/podman/pods/inspect.go
+++ b/cmd/podman/pods/inspect.go
@@ -37,7 +37,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: inspectCmd,
Parent: podCmd,
})
diff --git a/cmd/podman/pods/kill.go b/cmd/podman/pods/kill.go
index 17d5499c8..66693b419 100644
--- a/cmd/podman/pods/kill.go
+++ b/cmd/podman/pods/kill.go
@@ -37,7 +37,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: killCommand,
Parent: podCmd,
})
diff --git a/cmd/podman/pods/pause.go b/cmd/podman/pods/pause.go
index 6624ccbd7..c1cc151e0 100644
--- a/cmd/podman/pods/pause.go
+++ b/cmd/podman/pods/pause.go
@@ -37,7 +37,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: pauseCommand,
Parent: podCmd,
})
diff --git a/cmd/podman/pods/pod.go b/cmd/podman/pods/pod.go
index 00fb02936..e6e23fd1f 100644
--- a/cmd/podman/pods/pod.go
+++ b/cmd/podman/pods/pod.go
@@ -3,7 +3,6 @@ package pods
import (
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/validate"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/util"
"github.com/spf13/cobra"
)
@@ -24,7 +23,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: podCmd,
})
}
diff --git a/cmd/podman/pods/prune.go b/cmd/podman/pods/prune.go
index 51b6bb4a9..8032c9f12 100644
--- a/cmd/podman/pods/prune.go
+++ b/cmd/podman/pods/prune.go
@@ -35,7 +35,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: pruneCommand,
Parent: podCmd,
})
diff --git a/cmd/podman/pods/ps.go b/cmd/podman/pods/ps.go
index beaeda871..0271930e8 100644
--- a/cmd/podman/pods/ps.go
+++ b/cmd/podman/pods/ps.go
@@ -45,7 +45,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: psCmd,
Parent: podCmd,
})
diff --git a/cmd/podman/pods/restart.go b/cmd/podman/pods/restart.go
index 5b9f47a5b..5b7ea121d 100644
--- a/cmd/podman/pods/restart.go
+++ b/cmd/podman/pods/restart.go
@@ -37,7 +37,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: restartCommand,
Parent: podCmd,
})
diff --git a/cmd/podman/pods/rm.go b/cmd/podman/pods/rm.go
index 333e4eb9f..fbaf64c1f 100644
--- a/cmd/podman/pods/rm.go
+++ b/cmd/podman/pods/rm.go
@@ -45,7 +45,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: rmCommand,
Parent: podCmd,
})
diff --git a/cmd/podman/pods/start.go b/cmd/podman/pods/start.go
index f6dca854e..e39891a9b 100644
--- a/cmd/podman/pods/start.go
+++ b/cmd/podman/pods/start.go
@@ -45,7 +45,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: startCommand,
Parent: podCmd,
})
diff --git a/cmd/podman/pods/stats.go b/cmd/podman/pods/stats.go
index 97147275e..057b3dead 100644
--- a/cmd/podman/pods/stats.go
+++ b/cmd/podman/pods/stats.go
@@ -48,7 +48,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: statsCmd,
Parent: podCmd,
})
diff --git a/cmd/podman/pods/stop.go b/cmd/podman/pods/stop.go
index a9a16b39c..bcc054b8e 100644
--- a/cmd/podman/pods/stop.go
+++ b/cmd/podman/pods/stop.go
@@ -46,7 +46,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: stopCommand,
Parent: podCmd,
})
diff --git a/cmd/podman/pods/top.go b/cmd/podman/pods/top.go
index be8aab761..e26e281c8 100644
--- a/cmd/podman/pods/top.go
+++ b/cmd/podman/pods/top.go
@@ -39,7 +39,6 @@ podman pod top podID -eo user,pid,comm`,
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: topCommand,
Parent: podCmd,
})
diff --git a/cmd/podman/pods/unpause.go b/cmd/podman/pods/unpause.go
index 859ac8ac2..ef1aea7c8 100644
--- a/cmd/podman/pods/unpause.go
+++ b/cmd/podman/pods/unpause.go
@@ -39,7 +39,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: unpauseCommand,
Parent: podCmd,
})
diff --git a/cmd/podman/registry/config.go b/cmd/podman/registry/config.go
index 3ce6e3899..25139a3de 100644
--- a/cmd/podman/registry/config.go
+++ b/cmd/podman/registry/config.go
@@ -15,14 +15,25 @@ import (
)
const (
- ParentNSRequired = "ParentNSRequired"
+ // ParentNSRequired used as cobra.Annotation when command requires root access
+ ParentNSRequired = "ParentNSRequired"
+
+ // UnshareNSRequired used as cobra.Annotation when command requires modified user namespace
UnshareNSRequired = "UnshareNSRequired"
+
+ // EngineMode used as cobra.Annotation when command supports a limited number of Engines
+ EngineMode = "EngineMode"
)
var (
podmanOptions entities.PodmanConfig
podmanSync sync.Once
abiSupport = false
+
+ // ABIMode used in cobra.Annotations registry.EngineMode when command only supports ABIMode
+ ABIMode = entities.ABIMode.String()
+ // TunnelMode used in in cobra.Annotations registry.EngineMode when command only supports TunnelMode
+ TunnelMode = entities.TunnelMode.String()
)
// PodmanConfig returns an entities.PodmanConfig built up from
diff --git a/cmd/podman/registry/registry.go b/cmd/podman/registry/registry.go
index 0b1d9293a..607ef6d8e 100644
--- a/cmd/podman/registry/registry.go
+++ b/cmd/podman/registry/registry.go
@@ -19,7 +19,6 @@ const DefaultRootAPIPath = "/run/podman/podman.sock"
const DefaultRootAPIAddress = "unix:" + DefaultRootAPIPath
type CliCommand struct {
- Mode []entities.EngineMode
Command *cobra.Command
Parent *cobra.Command
}
diff --git a/cmd/podman/secrets/create.go b/cmd/podman/secrets/create.go
index 4204f30b4..f5739e99a 100644
--- a/cmd/podman/secrets/create.go
+++ b/cmd/podman/secrets/create.go
@@ -35,7 +35,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: createCmd,
Parent: secretCmd,
})
diff --git a/cmd/podman/secrets/inspect.go b/cmd/podman/secrets/inspect.go
index bcb1adb5e..874456f29 100644
--- a/cmd/podman/secrets/inspect.go
+++ b/cmd/podman/secrets/inspect.go
@@ -33,7 +33,6 @@ var format string
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: inspectCmd,
Parent: secretCmd,
})
diff --git a/cmd/podman/secrets/list.go b/cmd/podman/secrets/list.go
index ba7065d61..448a69994 100644
--- a/cmd/podman/secrets/list.go
+++ b/cmd/podman/secrets/list.go
@@ -39,7 +39,6 @@ type listFlagType struct {
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: lsCmd,
Parent: secretCmd,
})
diff --git a/cmd/podman/secrets/rm.go b/cmd/podman/secrets/rm.go
index ade015b10..dd3f5d9b9 100644
--- a/cmd/podman/secrets/rm.go
+++ b/cmd/podman/secrets/rm.go
@@ -24,7 +24,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: rmCmd,
Parent: secretCmd,
})
diff --git a/cmd/podman/secrets/secret.go b/cmd/podman/secrets/secret.go
index 139997b87..610b331d1 100644
--- a/cmd/podman/secrets/secret.go
+++ b/cmd/podman/secrets/secret.go
@@ -3,7 +3,6 @@ package secrets
import (
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/validate"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/spf13/cobra"
)
@@ -19,7 +18,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: secretCmd,
})
}
diff --git a/cmd/podman/system/connection.go b/cmd/podman/system/connection.go
index dbdda8cf9..1f8e8f13f 100644
--- a/cmd/podman/system/connection.go
+++ b/cmd/podman/system/connection.go
@@ -3,7 +3,6 @@ package system
import (
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/validate"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/spf13/cobra"
)
@@ -14,20 +13,18 @@ var (
}
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,
+ Use: "connection",
+ Short: "Manage remote ssh destinations",
+ Long: `Manage ssh destination information in podman configuration`,
+ 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,
Parent: systemCmd,
})
diff --git a/cmd/podman/system/connection/add.go b/cmd/podman/system/connection/add.go
index 89d28849c..ecfeb6608 100644
--- a/cmd/podman/system/connection/add.go
+++ b/cmd/podman/system/connection/add.go
@@ -15,7 +15,6 @@ import (
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/system"
"github.com/containers/podman/v3/libpod/define"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/terminal"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
@@ -53,7 +52,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: addCmd,
Parent: system.ConnectionCmd,
})
diff --git a/cmd/podman/system/connection/default.go b/cmd/podman/system/connection/default.go
index 073bdbc3f..cfedc337b 100644
--- a/cmd/podman/system/connection/default.go
+++ b/cmd/podman/system/connection/default.go
@@ -7,27 +7,24 @@ import (
"github.com/containers/podman/v3/cmd/podman/common"
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/system"
- "github.com/containers/podman/v3/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,
- ValidArgsFunction: common.AutocompleteSystemConnections,
- RunE: defaultRunE,
- Example: `podman system connection default testing`,
+ Use: "default NAME",
+ Args: cobra.ExactArgs(1),
+ Short: "Set named destination as default",
+ Long: `Set named destination as default for the Podman service`,
+ ValidArgsFunction: common.AutocompleteSystemConnections,
+ 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,
})
diff --git a/cmd/podman/system/connection/list.go b/cmd/podman/system/connection/list.go
index fe7026ae3..ae88b0b30 100644
--- a/cmd/podman/system/connection/list.go
+++ b/cmd/podman/system/connection/list.go
@@ -10,18 +10,16 @@ import (
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/system"
"github.com/containers/podman/v3/cmd/podman/validate"
- "github.com/containers/podman/v3/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,
+ 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`,
Example: `podman system connection list
podman system connection ls`,
ValidArgsFunction: completion.AutocompleteNone,
@@ -32,7 +30,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: listCmd,
Parent: system.ConnectionCmd,
})
diff --git a/cmd/podman/system/connection/remove.go b/cmd/podman/system/connection/remove.go
index 4acaa36a9..73bae4994 100644
--- a/cmd/podman/system/connection/remove.go
+++ b/cmd/podman/system/connection/remove.go
@@ -5,21 +5,19 @@ import (
"github.com/containers/podman/v3/cmd/podman/common"
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/system"
- "github.com/containers/podman/v3/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,
- ValidArgsFunction: common.AutocompleteSystemConnections,
- RunE: rm,
+ Use: "remove NAME",
+ Args: cobra.ExactArgs(1),
+ Aliases: []string{"rm"},
+ Long: `Delete named destination from podman configuration`,
+ Short: "Delete named destination",
+ ValidArgsFunction: common.AutocompleteSystemConnections,
+ RunE: rm,
Example: `podman system connection remove devl
podman system connection rm devl`,
}
@@ -27,7 +25,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: rmCmd,
Parent: system.ConnectionCmd,
})
diff --git a/cmd/podman/system/connection/rename.go b/cmd/podman/system/connection/rename.go
index 7713c2b09..898457d38 100644
--- a/cmd/podman/system/connection/rename.go
+++ b/cmd/podman/system/connection/rename.go
@@ -7,21 +7,19 @@ import (
"github.com/containers/podman/v3/cmd/podman/common"
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/system"
- "github.com/containers/podman/v3/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,
- ValidArgsFunction: common.AutocompleteSystemConnections,
- RunE: rename,
+ 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"`,
+ ValidArgsFunction: common.AutocompleteSystemConnections,
+ RunE: rename,
Example: `podman system connection rename laptop devl,
podman system connection mv laptop devl`,
}
@@ -29,7 +27,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: renameCmd,
Parent: system.ConnectionCmd,
})
diff --git a/cmd/podman/system/df.go b/cmd/podman/system/df.go
index 5e179a82d..de56c57d0 100644
--- a/cmd/podman/system/df.go
+++ b/cmd/podman/system/df.go
@@ -40,7 +40,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: dfSystemCommand,
Parent: systemCmd,
})
diff --git a/cmd/podman/system/events.go b/cmd/podman/system/events.go
index 568610bdc..4aa413ec6 100644
--- a/cmd/podman/system/events.go
+++ b/cmd/podman/system/events.go
@@ -41,7 +41,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: eventsCommand,
})
flags := eventsCommand.Flags()
diff --git a/cmd/podman/system/info.go b/cmd/podman/system/info.go
index 44be4ccec..1dc90f79a 100644
--- a/cmd/podman/system/info.go
+++ b/cmd/podman/system/info.go
@@ -11,7 +11,6 @@ import (
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/validate"
"github.com/containers/podman/v3/libpod/define"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/ghodss/yaml"
"github.com/spf13/cobra"
)
@@ -49,13 +48,11 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: infoCommand,
})
infoFlags(infoCommand)
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: systemInfoCommand,
Parent: systemCmd,
})
diff --git a/cmd/podman/system/migrate.go b/cmd/podman/system/migrate.go
index 892d60a38..9940cd063 100644
--- a/cmd/podman/system/migrate.go
+++ b/cmd/podman/system/migrate.go
@@ -22,6 +22,7 @@ var (
`
migrateCommand = &cobra.Command{
+ Annotations: map[string]string{registry.EngineMode: registry.ABIMode},
Use: "migrate [options]",
Args: validate.NoArgs,
Short: "Migrate containers",
@@ -37,7 +38,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode},
Command: migrateCommand,
Parent: systemCmd,
})
diff --git a/cmd/podman/system/prune.go b/cmd/podman/system/prune.go
index 0f1285564..e09e2d5e5 100644
--- a/cmd/podman/system/prune.go
+++ b/cmd/podman/system/prune.go
@@ -41,7 +41,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: pruneCommand,
Parent: systemCmd,
})
diff --git a/cmd/podman/system/renumber.go b/cmd/podman/system/renumber.go
index 91c49333a..83a873c2a 100644
--- a/cmd/podman/system/renumber.go
+++ b/cmd/podman/system/renumber.go
@@ -23,19 +23,18 @@ var (
`
renumberCommand = &cobra.Command{
- Use: "renumber",
- Args: validate.NoArgs,
- DisableFlagsInUseLine: true,
- Short: "Migrate lock numbers",
- Long: renumberDescription,
- Run: renumber,
- ValidArgsFunction: completion.AutocompleteNone,
+ Annotations: map[string]string{registry.EngineMode: registry.ABIMode},
+ Use: "renumber",
+ Args: validate.NoArgs,
+ Short: "Migrate lock numbers",
+ Long: renumberDescription,
+ Run: renumber,
+ ValidArgsFunction: completion.AutocompleteNone,
}
)
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode},
Command: renumberCommand,
Parent: systemCmd,
})
diff --git a/cmd/podman/system/reset.go b/cmd/podman/system/reset.go
index 6f2f873dd..0edb36889 100644
--- a/cmd/podman/system/reset.go
+++ b/cmd/podman/system/reset.go
@@ -23,6 +23,7 @@ var (
All containers will be stopped and removed, and all images, volumes and container content will be removed.
`
systemResetCommand = &cobra.Command{
+ Annotations: map[string]string{registry.EngineMode: registry.ABIMode},
Use: "reset [options]",
Args: validate.NoArgs,
Short: "Reset podman storage",
@@ -36,7 +37,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode},
Command: systemResetCommand,
Parent: systemCmd,
})
diff --git a/cmd/podman/system/service.go b/cmd/podman/system/service.go
index 1e1cdbd12..63f2de51e 100644
--- a/cmd/podman/system/service.go
+++ b/cmd/podman/system/service.go
@@ -28,6 +28,7 @@ Enable a listening service for API access to Podman commands.
`
srvCmd = &cobra.Command{
+ Annotations: map[string]string{registry.EngineMode: registry.ABIMode},
Use: "service [options] [URI]",
Args: cobra.MaximumNArgs(1),
Short: "Run API service",
@@ -44,7 +45,6 @@ Enable a listening service for API access to Podman commands.
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode},
Command: srvCmd,
Parent: systemCmd,
})
diff --git a/cmd/podman/system/system.go b/cmd/podman/system/system.go
index ab06c3ae0..1947decaf 100644
--- a/cmd/podman/system/system.go
+++ b/cmd/podman/system/system.go
@@ -3,7 +3,6 @@ package system
import (
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/validate"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/spf13/cobra"
)
@@ -22,7 +21,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: systemCmd,
})
}
diff --git a/cmd/podman/system/unshare.go b/cmd/podman/system/unshare.go
index c07751532..f930d8b62 100644
--- a/cmd/podman/system/unshare.go
+++ b/cmd/podman/system/unshare.go
@@ -15,12 +15,12 @@ var (
unshareOptions = entities.SystemUnshareOptions{}
unshareDescription = "Runs a command in a modified user namespace."
unshareCommand = &cobra.Command{
- Use: "unshare [options] [COMMAND [ARG...]]",
- DisableFlagsInUseLine: true,
- Short: "Run a command in a modified user namespace",
- Long: unshareDescription,
- RunE: unshare,
- ValidArgsFunction: completion.AutocompleteDefault,
+ Annotations: map[string]string{registry.EngineMode: registry.ABIMode},
+ Use: "unshare [options] [COMMAND [ARG...]]",
+ Short: "Run a command in a modified user namespace",
+ Long: unshareDescription,
+ RunE: unshare,
+ ValidArgsFunction: completion.AutocompleteDefault,
Example: `podman unshare id
podman unshare cat /proc/self/uid_map,
podman unshare podman-script.sh`,
@@ -29,7 +29,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode},
Command: unshareCommand,
})
flags := unshareCommand.Flags()
diff --git a/cmd/podman/system/version.go b/cmd/podman/system/version.go
index ad9fd2a85..5575fc87d 100644
--- a/cmd/podman/system/version.go
+++ b/cmd/podman/system/version.go
@@ -31,7 +31,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: versionCommand,
})
flags := versionCommand.Flags()
diff --git a/cmd/podman/volumes/create.go b/cmd/podman/volumes/create.go
index 1820260a4..70373d69d 100644
--- a/cmd/podman/volumes/create.go
+++ b/cmd/podman/volumes/create.go
@@ -37,7 +37,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: createCommand,
Parent: volumeCmd,
})
diff --git a/cmd/podman/volumes/exists.go b/cmd/podman/volumes/exists.go
index 4dfbb3cd4..85bbcb29a 100644
--- a/cmd/podman/volumes/exists.go
+++ b/cmd/podman/volumes/exists.go
@@ -3,7 +3,6 @@ package volumes
import (
"github.com/containers/podman/v3/cmd/podman/common"
"github.com/containers/podman/v3/cmd/podman/registry"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/spf13/cobra"
)
@@ -22,7 +21,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: volumeExistsCommand,
Parent: volumeCmd,
})
diff --git a/cmd/podman/volumes/inspect.go b/cmd/podman/volumes/inspect.go
index d52eee9f3..7510f8a1c 100644
--- a/cmd/podman/volumes/inspect.go
+++ b/cmd/podman/volumes/inspect.go
@@ -32,7 +32,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: inspectCommand,
Parent: volumeCmd,
})
diff --git a/cmd/podman/volumes/list.go b/cmd/podman/volumes/list.go
index f402afa94..990b39435 100644
--- a/cmd/podman/volumes/list.go
+++ b/cmd/podman/volumes/list.go
@@ -49,7 +49,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: lsCommand,
Parent: volumeCmd,
})
diff --git a/cmd/podman/volumes/prune.go b/cmd/podman/volumes/prune.go
index 8e190b870..1f3cc6913 100644
--- a/cmd/podman/volumes/prune.go
+++ b/cmd/podman/volumes/prune.go
@@ -35,7 +35,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: pruneCommand,
Parent: volumeCmd,
})
diff --git a/cmd/podman/volumes/rm.go b/cmd/podman/volumes/rm.go
index e149e398c..9ba4a30a1 100644
--- a/cmd/podman/volumes/rm.go
+++ b/cmd/podman/volumes/rm.go
@@ -37,7 +37,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: rmCommand,
Parent: volumeCmd,
})
diff --git a/cmd/podman/volumes/volume.go b/cmd/podman/volumes/volume.go
index 7786d5dc3..f42a6d81a 100644
--- a/cmd/podman/volumes/volume.go
+++ b/cmd/podman/volumes/volume.go
@@ -3,7 +3,6 @@ package volumes
import (
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/validate"
- "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/spf13/cobra"
)
@@ -22,7 +21,6 @@ var (
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
- Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: volumeCmd,
})
}
diff --git a/docs/source/markdown/podman-manifest-add.1.md b/docs/source/markdown/podman-manifest-add.1.md
index 3a0e34ee5..376301589 100644
--- a/docs/source/markdown/podman-manifest-add.1.md
+++ b/docs/source/markdown/podman-manifest-add.1.md
@@ -93,6 +93,28 @@ architecture value, but which expect different versions of its instruction set.
$ podman manifest add mylist:v1.11 containers-storage:quay.io/username/myimage
+ **dir:**_path_
+ An existing local directory _path_ storing the manifest, layer tarballs, and signatures as individual files. This
+ is a non-standardized format, primarily useful for debugging or noninvasive container inspection.
+
+ $ podman manifest add dir:/tmp/myimage
+
+ **docker-archive:**_path_[**:**_docker-reference_]
+ An image is stored in the `docker save` formatted file. _docker-reference_ is only used when creating such a
+ file, and it must not contain a digest.
+
+ $ podman manifest add docker-archive:/tmp/myimage
+
+ **docker-daemon:**_docker-reference_
+ An image in _docker-reference_ format stored in the docker daemon internal storage. The _docker-reference_ can also be an image ID (docker-daemon:algo:digest).
+
+ $ sudo podman manifest add docker-daemon:docker.io/library/myimage:33
+
+ **oci-archive:**_path_**:**_tag_
+ An image _tag_ in a directory compliant with "Open Container Image Layout Specification" at _path_.
+
+ $ podman manifest add oci-archive:/tmp/myimage
+
## EXAMPLE
```
diff --git a/go.mod b/go.mod
index 4c320f7c5..a6da2ad33 100644
--- a/go.mod
+++ b/go.mod
@@ -12,12 +12,12 @@ require (
github.com/containernetworking/cni v0.8.1
github.com/containernetworking/plugins v0.9.1
github.com/containers/buildah v1.21.0
- github.com/containers/common v0.38.4
+ github.com/containers/common v0.39.0
github.com/containers/conmon v2.0.20+incompatible
github.com/containers/image/v5 v5.12.0
github.com/containers/ocicrypt v1.1.1
github.com/containers/psgo v1.5.2
- github.com/containers/storage v1.31.2
+ github.com/containers/storage v1.32.1
github.com/coreos/go-systemd/v22 v22.3.2
github.com/coreos/stream-metadata-go v0.0.0-20210225230131-70edb9eb47b3
github.com/cri-o/ocicni v0.2.1-0.20210301205850-541cf7c703cf
@@ -43,7 +43,7 @@ require (
github.com/moby/term v0.0.0-20201216013528-df9cb8a40635
github.com/mrunalp/fileutils v0.5.0
github.com/onsi/ginkgo v1.16.2
- github.com/onsi/gomega v1.12.0
+ github.com/onsi/gomega v1.13.0
github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/image-spec v1.0.2-0.20190823105129-775207bd45b6
github.com/opencontainers/runc v1.0.0-rc95
diff --git a/go.sum b/go.sum
index 39827f61a..7aee92177 100644
--- a/go.sum
+++ b/go.sum
@@ -218,8 +218,9 @@ github.com/containernetworking/plugins v0.9.1 h1:FD1tADPls2EEi3flPc2OegIY1M9pUa9
github.com/containernetworking/plugins v0.9.1/go.mod h1:xP/idU2ldlzN6m4p5LmGiwRDjeJr6FLK6vuiUwoH7P8=
github.com/containers/buildah v1.21.0 h1:LuwuqRPjan3X3AIdGwfkEkqMgmrDMNpQznFqNdHgCz8=
github.com/containers/buildah v1.21.0/go.mod h1:yPdlpVd93T+i91yGxrJbW1YOWrqN64j5ZhHOZmHUejs=
-github.com/containers/common v0.38.4 h1:WYv4R6Sw1qiOPZtBNbKglrmisXdPcq3fZ3bGy4prrjo=
github.com/containers/common v0.38.4/go.mod h1:egfpX/Y3+19Dz4Wa1eRZDdgzoEOeneieF9CQppKzLBg=
+github.com/containers/common v0.39.0 h1:MrvpFa/bM4UmUILACv2IhOif4oLmWAiD4C+CpOc/MUo=
+github.com/containers/common v0.39.0/go.mod h1:vPUHCg/dHoiyqIyLN+EdbjUaGrVEhs/hAvsqsxuYepk=
github.com/containers/conmon v2.0.20+incompatible h1:YbCVSFSCqFjjVwHTPINGdMX1F6JXHGTUje2ZYobNrkg=
github.com/containers/conmon v2.0.20+incompatible/go.mod h1:hgwZ2mtuDrppv78a/cOBNiCm6O0UMWGx1mu7P00nu5I=
github.com/containers/image/v5 v5.12.0 h1:1hNS2QkzFQ4lH3GYQLyAXB0acRMhS1Ubm6oV++8vw4w=
@@ -235,8 +236,9 @@ github.com/containers/psgo v1.5.2/go.mod h1:2ubh0SsreMZjSXW1Hif58JrEcFudQyIy9EzP
github.com/containers/storage v1.23.5/go.mod h1:ha26Q6ngehFNhf3AWoXldvAvwI4jFe3ETQAf/CeZPyM=
github.com/containers/storage v1.30.1/go.mod h1:NDJkiwxnSHD1Is+4DGcyR3SIEYSDOa0xnAW+uGQFx9E=
github.com/containers/storage v1.31.1/go.mod h1:IFEf+yRTS0pvCGQt2tBv1Kzz2XUSPvED6uFBmWG7V/E=
-github.com/containers/storage v1.31.2 h1:wWi7OsNtHUydGdK0EpQiK94MfQNj5qK2GtxNLoj4tU4=
-github.com/containers/storage v1.31.2/go.mod h1:J3q772EVbN9vgqoN/dkvInKnp4xK9ZXm7wHNfuiIDgE=
+github.com/containers/storage v1.32.0/go.mod h1:J3q772EVbN9vgqoN/dkvInKnp4xK9ZXm7wHNfuiIDgE=
+github.com/containers/storage v1.32.1 h1:JgvHY5dokiff+Ee4TdvPYO++Oq2BAave5DmyPetH2iU=
+github.com/containers/storage v1.32.1/go.mod h1:do6oIF71kfkVS3CPUZr+6He94fIaj6pzF8ywevPuuOw=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
@@ -530,8 +532,9 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o
github.com/klauspost/compress v1.11.0/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/klauspost/compress v1.11.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/klauspost/compress v1.11.13/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
-github.com/klauspost/compress v1.12.2 h1:2KCfW3I9M7nSc5wOqXAlW2v2U6v+w6cbjvbfp+OykW8=
github.com/klauspost/compress v1.12.2/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
+github.com/klauspost/compress v1.12.3 h1:G5AfA94pHPysR56qqrkO2pxEexdDzrpFJ6yt/VqWxVU=
+github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
github.com/klauspost/pgzip v1.2.5 h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE=
github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
@@ -655,8 +658,9 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/onsi/gomega v1.10.3/go.mod h1:V9xEwhxec5O8UDM77eCW8vLymOMltsqPVYWrpDsH8xc=
github.com/onsi/gomega v1.10.5/go.mod h1:gza4q3jKQJijlu05nKWRCW/GavJumGt8aNRxWg7mt48=
-github.com/onsi/gomega v1.12.0 h1:p4oGGk2M2UJc0wWN4lHFvIB71lxsh0T/UiKCCgFADY8=
github.com/onsi/gomega v1.12.0/go.mod h1:lRk9szgn8TxENtWd0Tp4c3wjlRfMTMH27I+3Je41yGY=
+github.com/onsi/gomega v1.13.0 h1:7lLHu94wT9Ij0o6EWWclhu0aOh32VxhkwEJvzuWPeak=
+github.com/onsi/gomega v1.13.0/go.mod h1:lRk9szgn8TxENtWd0Tp4c3wjlRfMTMH27I+3Je41yGY=
github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
diff --git a/libpod/container.go b/libpod/container.go
index 591cf9bc5..c6f0cd618 100644
--- a/libpod/container.go
+++ b/libpod/container.go
@@ -14,7 +14,6 @@ import (
"github.com/containers/image/v5/manifest"
"github.com/containers/podman/v3/libpod/define"
"github.com/containers/podman/v3/libpod/lock"
- "github.com/containers/podman/v3/pkg/rootless"
"github.com/containers/storage"
"github.com/cri-o/ocicni/pkg/ocicni"
spec "github.com/opencontainers/runtime-spec/specs-go"
@@ -1168,7 +1167,7 @@ func (c *Container) Networks() ([]string, bool, error) {
func (c *Container) networks() ([]string, bool, error) {
networks, err := c.runtime.state.GetNetworks(c)
if err != nil && errors.Cause(err) == define.ErrNoSuchNetwork {
- if len(c.config.Networks) == 0 && !rootless.IsRootless() {
+ if len(c.config.Networks) == 0 && c.config.NetMode.IsBridge() {
return []string{c.runtime.netPlugin.GetDefaultNetworkName()}, true, nil
}
return c.config.Networks, false, nil
diff --git a/libpod/container_log_linux.go b/libpod/container_log_linux.go
index ec4fa9724..892ee34e3 100644
--- a/libpod/container_log_linux.go
+++ b/libpod/container_log_linux.go
@@ -6,14 +6,12 @@ package libpod
import (
"context"
"fmt"
- "io"
- "math"
"strings"
"time"
- "github.com/containers/podman/v3/libpod/define"
+ "github.com/containers/podman/v3/libpod/events"
"github.com/containers/podman/v3/libpod/logs"
- journal "github.com/coreos/go-systemd/v22/sdjournal"
+ "github.com/coreos/go-systemd/v22/sdjournal"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
@@ -24,122 +22,187 @@ const (
// journaldLogErr is the journald priority signifying stderr
journaldLogErr = "3"
-
- // bufLen is the length of the buffer to read from a k8s-file
- // formatted log line
- // let's set it as 2k just to be safe if k8s-file format ever changes
- bufLen = 16384
)
func (c *Container) readFromJournal(ctx context.Context, options *logs.LogOptions, logChannel chan *logs.LogLine) error {
- var config journal.JournalReaderConfig
- if options.Tail < 0 {
- config.NumFromTail = 0
- } else if options.Tail == 0 {
- config.NumFromTail = math.MaxUint64
- } else {
- config.NumFromTail = uint64(options.Tail)
+ journal, err := sdjournal.NewJournal()
+ if err != nil {
+ return err
}
- if options.Multi {
- config.Formatter = journalFormatterWithID
- } else {
- config.Formatter = journalFormatter
- }
- defaultTime := time.Time{}
- if options.Since != defaultTime {
- // coreos/go-systemd/sdjournal doesn't correctly handle requests for data in the future
- // return nothing instead of falsely printing
- if time.Now().Before(options.Since) {
- return nil
- }
- // coreos/go-systemd/sdjournal expects a negative time.Duration for times in the past
- config.Since = -time.Since(options.Since)
+ // While logs are written to the `logChannel`, we inspect each event
+ // and stop once the container has died. Having logs and events in one
+ // stream prevents a race condition that we faced in #10323.
+
+ // Add the filters for events.
+ match := sdjournal.Match{Field: "SYSLOG_IDENTIFIER", Value: "podman"}
+ if err := journal.AddMatch(match.String()); err != nil {
+ return errors.Wrapf(err, "adding filter to journald logger: %v", match)
+ }
+ match = sdjournal.Match{Field: "PODMAN_ID", Value: c.ID()}
+ if err := journal.AddMatch(match.String()); err != nil {
+ return errors.Wrapf(err, "adding filter to journald logger: %v", match)
}
- config.Matches = append(config.Matches, journal.Match{
- Field: "CONTAINER_ID_FULL",
- Value: c.ID(),
- })
- options.WaitGroup.Add(1)
- r, err := journal.NewJournalReader(config)
- if err != nil {
+ // Add the filter for logs. Note the disjunction so that we match
+ // either the events or the logs.
+ if err := journal.AddDisjunction(); err != nil {
+ return errors.Wrap(err, "adding filter disjunction to journald logger")
+ }
+ match = sdjournal.Match{Field: "CONTAINER_ID_FULL", Value: c.ID()}
+ if err := journal.AddMatch(match.String()); err != nil {
+ return errors.Wrapf(err, "adding filter to journald logger: %v", match)
+ }
+
+ if err := journal.SeekHead(); err != nil {
return err
}
- if r == nil {
- return errors.Errorf("journal reader creation failed")
+ // API requires Next() immediately after SeekHead().
+ if _, err := journal.Next(); err != nil {
+ return errors.Wrap(err, "initial journal cursor")
}
- if options.Tail == math.MaxInt64 {
- r.Rewind()
+
+ // API requires a next|prev before getting a cursor.
+ if _, err := journal.Previous(); err != nil {
+ return errors.Wrap(err, "initial journal cursor")
}
- state, err := c.State()
- if err != nil {
- return err
+
+ // Note that the initial cursor may not yet be ready, so we'll do an
+ // exponential backoff.
+ var cursor string
+ var cursorError error
+ for i := 1; i <= 3; i++ {
+ cursor, cursorError = journal.GetCursor()
+ if err != nil {
+ continue
+ }
+ time.Sleep(time.Duration(i*100) * time.Millisecond)
+ break
+ }
+ if cursorError != nil {
+ return errors.Wrap(cursorError, "inital journal cursor")
+ }
+
+ // We need the container's events in the same journal to guarantee
+ // consistency, see #10323.
+ if options.Follow && c.runtime.config.Engine.EventsLogger != "journald" {
+ return errors.Errorf("using --follow with the journald --log-driver but without the journald --events-backend (%s) is not supported", c.runtime.config.Engine.EventsLogger)
}
- if options.Follow && state == define.ContainerStateRunning {
- go func() {
- done := make(chan bool)
- until := make(chan time.Time)
- go func() {
- select {
- case <-ctx.Done():
- until <- time.Time{}
- case <-done:
- // nothing to do anymore
+ options.WaitGroup.Add(1)
+ go func() {
+ defer func() {
+ options.WaitGroup.Done()
+ if err := journal.Close(); err != nil {
+ logrus.Errorf("Unable to close journal: %v", err)
+ }
+ }()
+
+ afterTimeStamp := false // needed for options.Since
+ tailQueue := []*logs.LogLine{} // needed for options.Tail
+ doTail := options.Tail > 0
+ for {
+ select {
+ case <-ctx.Done():
+ // Remote client may have closed/lost the connection.
+ return
+ default:
+ // Fallthrough
+ }
+
+ if _, err := journal.Next(); err != nil {
+ logrus.Errorf("Failed to move journal cursor to next entry: %v", err)
+ return
+ }
+ latestCursor, err := journal.GetCursor()
+ if err != nil {
+ logrus.Errorf("Failed to get journal cursor: %v", err)
+ return
+ }
+
+ // Hit the end of the journal.
+ if cursor == latestCursor {
+ if doTail {
+ // Flush *once* we hit the end of the journal.
+ startIndex := int64(len(tailQueue)-1) - options.Tail
+ if startIndex < 0 {
+ startIndex = 0
+ }
+ for i := startIndex; i < int64(len(tailQueue)); i++ {
+ logChannel <- tailQueue[i]
+ }
+ tailQueue = nil
+ doTail = false
+ }
+ // Unless we follow, quit.
+ if !options.Follow {
+ return
}
- }()
- go func() {
- // FIXME (#10323): we are facing a terrible
- // race condition here. At the time the
- // container dies and `c.Wait()` has returned,
- // we may not have received all journald logs.
- // So far there is no other way than waiting
- // for a second. Ultimately, `r.Follow` is
- // racy and we may have to implement our custom
- // logic here.
- c.Wait(ctx)
- time.Sleep(time.Second)
- until <- time.Time{}
- }()
- follower := journaldFollowBuffer{logChannel, options.Multi}
- err := r.Follow(until, follower)
+ // Sleep until something's happening on the journal.
+ journal.Wait(sdjournal.IndefiniteWait)
+ continue
+ }
+ cursor = latestCursor
+
+ entry, err := journal.GetEntry()
if err != nil {
- logrus.Debugf(err.Error())
+ logrus.Errorf("Failed to get journal entry: %v", err)
+ return
}
- r.Close()
- options.WaitGroup.Done()
- done <- true
- return
- }()
- return nil
- }
- go func() {
- bytes := make([]byte, bufLen)
- // /me complains about no do-while in go
- ec, err := r.Read(bytes)
- for ec != 0 && err == nil {
- // because we are reusing bytes, we need to make
- // sure the old data doesn't get into the new line
- bytestr := string(bytes[:ec])
- logLine, err2 := logs.NewJournaldLogLine(bytestr, options.Multi)
- if err2 != nil {
- logrus.Error(err2)
+ if !afterTimeStamp {
+ entryTime := time.Unix(0, int64(entry.RealtimeTimestamp)*int64(time.Microsecond))
+ if entryTime.Before(options.Since) {
+ continue
+ }
+ afterTimeStamp = true
+ }
+
+ // If we're reading an event and the container exited/died,
+ // then we're done and can return.
+ event, ok := entry.Fields["PODMAN_EVENT"]
+ if ok {
+ status, err := events.StringToStatus(event)
+ if err != nil {
+ logrus.Errorf("Failed to translate event: %v", err)
+ return
+ }
+ if status == events.Exited {
+ return
+ }
+ continue
+ }
+
+ var message string
+ var formatError error
+
+ if options.Multi {
+ message, formatError = journalFormatterWithID(entry)
+ } else {
+ message, formatError = journalFormatter(entry)
+ }
+
+ if formatError != nil {
+ logrus.Errorf("Failed to parse journald log entry: %v", err)
+ return
+ }
+
+ logLine, err := logs.NewJournaldLogLine(message, options.Multi)
+ if err != nil {
+ logrus.Errorf("Failed parse log line: %v", err)
+ return
+ }
+ if doTail {
+ tailQueue = append(tailQueue, logLine)
continue
}
logChannel <- logLine
- ec, err = r.Read(bytes)
}
- if err != nil && err != io.EOF {
- logrus.Error(err)
- }
- r.Close()
- options.WaitGroup.Done()
}()
+
return nil
}
-func journalFormatterWithID(entry *journal.JournalEntry) (string, error) {
+func journalFormatterWithID(entry *sdjournal.JournalEntry) (string, error) {
output, err := formatterPrefix(entry)
if err != nil {
return "", err
@@ -162,7 +225,7 @@ func journalFormatterWithID(entry *journal.JournalEntry) (string, error) {
return output, nil
}
-func journalFormatter(entry *journal.JournalEntry) (string, error) {
+func journalFormatter(entry *sdjournal.JournalEntry) (string, error) {
output, err := formatterPrefix(entry)
if err != nil {
return "", err
@@ -176,7 +239,7 @@ func journalFormatter(entry *journal.JournalEntry) (string, error) {
return output, nil
}
-func formatterPrefix(entry *journal.JournalEntry) (string, error) {
+func formatterPrefix(entry *sdjournal.JournalEntry) (string, error) {
usec := entry.RealtimeTimestamp
tsString := time.Unix(0, int64(usec)*int64(time.Microsecond)).Format(logs.LogTimeFormat)
output := fmt.Sprintf("%s ", tsString)
@@ -202,7 +265,7 @@ func formatterPrefix(entry *journal.JournalEntry) (string, error) {
return output, nil
}
-func formatterMessage(entry *journal.JournalEntry) (string, error) {
+func formatterMessage(entry *sdjournal.JournalEntry) (string, error) {
// Finally, append the message
msg, ok := entry.Fields["MESSAGE"]
if !ok {
@@ -211,18 +274,3 @@ func formatterMessage(entry *journal.JournalEntry) (string, error) {
msg = strings.TrimSuffix(msg, "\n")
return msg, nil
}
-
-type journaldFollowBuffer struct {
- logChannel chan *logs.LogLine
- withID bool
-}
-
-func (f journaldFollowBuffer) Write(p []byte) (int, error) {
- bytestr := string(p)
- logLine, err := logs.NewJournaldLogLine(bytestr, f.withID)
- if err != nil {
- return -1, err
- }
- f.logChannel <- logLine
- return len(p), nil
-}
diff --git a/libpod/network/config.go b/libpod/network/config.go
index ac4478602..9a3bc4763 100644
--- a/libpod/network/config.go
+++ b/libpod/network/config.go
@@ -44,17 +44,17 @@ type CNIPlugins interface {
// HostLocalBridge describes a configuration for a bridge plugin
// https://github.com/containernetworking/plugins/tree/master/plugins/main/bridge#network-configuration-reference
type HostLocalBridge struct {
- PluginType string `json:"type"`
- BrName string `json:"bridge,omitempty"`
- IsGW bool `json:"isGateway"`
- IsDefaultGW bool `json:"isDefaultGateway,omitempty"`
- ForceAddress bool `json:"forceAddress,omitempty"`
- IPMasq bool `json:"ipMasq,omitempty"`
- MTU int `json:"mtu,omitempty"`
- HairpinMode bool `json:"hairpinMode,omitempty"`
- PromiscMode bool `json:"promiscMode,omitempty"`
- Vlan int `json:"vlan,omitempty"`
- IPAM IPAMHostLocalConf `json:"ipam"`
+ PluginType string `json:"type"`
+ BrName string `json:"bridge,omitempty"`
+ IsGW bool `json:"isGateway"`
+ IsDefaultGW bool `json:"isDefaultGateway,omitempty"`
+ ForceAddress bool `json:"forceAddress,omitempty"`
+ IPMasq bool `json:"ipMasq,omitempty"`
+ MTU int `json:"mtu,omitempty"`
+ HairpinMode bool `json:"hairpinMode,omitempty"`
+ PromiscMode bool `json:"promiscMode,omitempty"`
+ Vlan int `json:"vlan,omitempty"`
+ IPAM IPAMConfig `json:"ipam"`
}
// Bytes outputs []byte
@@ -62,9 +62,9 @@ func (h *HostLocalBridge) Bytes() ([]byte, error) {
return json.MarshalIndent(h, "", "\t")
}
-// IPAMHostLocalConf describes an IPAM configuration
+// IPAMConfig describes an IPAM configuration
// https://github.com/containernetworking/plugins/tree/master/plugins/ipam/host-local#network-configuration-reference
-type IPAMHostLocalConf struct {
+type IPAMConfig struct {
PluginType string `json:"type"`
Routes []IPAMRoute `json:"routes,omitempty"`
ResolveConf string `json:"resolveConf,omitempty"`
@@ -81,7 +81,7 @@ type IPAMLocalHostRangeConf struct {
}
// Bytes outputs the configuration as []byte
-func (i IPAMHostLocalConf) Bytes() ([]byte, error) {
+func (i IPAMConfig) Bytes() ([]byte, error) {
return json.MarshalIndent(i, "", "\t")
}
@@ -101,19 +101,12 @@ func (p PortMapConfig) Bytes() ([]byte, error) {
return json.MarshalIndent(p, "", "\t")
}
-// IPAMDHCP describes the ipamdhcp config
-type IPAMDHCP struct {
- DHCP string `json:"type"`
- Routes []IPAMRoute `json:"routes,omitempty"`
- Ranges [][]IPAMLocalHostRangeConf `json:"ranges,omitempty"`
-}
-
// MacVLANConfig describes the macvlan config
type MacVLANConfig struct {
- PluginType string `json:"type"`
- Master string `json:"master"`
- IPAM IPAMDHCP `json:"ipam"`
- MTU int `json:"mtu,omitempty"`
+ PluginType string `json:"type"`
+ Master string `json:"master"`
+ IPAM IPAMConfig `json:"ipam"`
+ MTU int `json:"mtu,omitempty"`
}
// Bytes outputs the configuration as []byte
diff --git a/libpod/network/netconflist.go b/libpod/network/netconflist.go
index d2031df6d..d6c33740e 100644
--- a/libpod/network/netconflist.go
+++ b/libpod/network/netconflist.go
@@ -45,7 +45,7 @@ func NewNcList(name, version string, labels NcLabels) NcList {
}
// NewHostLocalBridge creates a new LocalBridge for host-local
-func NewHostLocalBridge(name string, isGateWay, isDefaultGW, ipMasq bool, mtu int, vlan int, ipamConf IPAMHostLocalConf) *HostLocalBridge {
+func NewHostLocalBridge(name string, isGateWay, isDefaultGW, ipMasq bool, mtu int, vlan int, ipamConf IPAMConfig) *HostLocalBridge {
hostLocalBridge := HostLocalBridge{
PluginType: "bridge",
BrName: name,
@@ -65,8 +65,8 @@ func NewHostLocalBridge(name string, isGateWay, isDefaultGW, ipMasq bool, mtu in
}
// NewIPAMHostLocalConf creates a new IPAMHostLocal configuration
-func NewIPAMHostLocalConf(routes []IPAMRoute, ipamRanges [][]IPAMLocalHostRangeConf) (IPAMHostLocalConf, error) {
- ipamConf := IPAMHostLocalConf{
+func NewIPAMHostLocalConf(routes []IPAMRoute, ipamRanges [][]IPAMLocalHostRangeConf) (IPAMConfig, error) {
+ ipamConf := IPAMConfig{
PluginType: "host-local",
Routes: routes,
// Possible future support ? Leaving for clues
@@ -177,8 +177,10 @@ func HasDNSNamePlugin(paths []string) bool {
// NewMacVLANPlugin creates a macvlanconfig with a given device name
func NewMacVLANPlugin(device string, gateway net.IP, ipRange *net.IPNet, subnet *net.IPNet, mtu int) (MacVLANConfig, error) {
- i := IPAMDHCP{DHCP: "dhcp"}
- if gateway != nil || ipRange != nil || subnet != nil {
+ i := IPAMConfig{PluginType: "dhcp"}
+ if gateway != nil ||
+ (ipRange != nil && ipRange.IP != nil && ipRange.Mask != nil) ||
+ (subnet != nil && subnet.IP != nil && subnet.Mask != nil) {
ipam, err := NewIPAMLocalHostRange(subnet, ipRange, gateway)
if err != nil {
return MacVLANConfig{}, err
@@ -186,6 +188,12 @@ func NewMacVLANPlugin(device string, gateway net.IP, ipRange *net.IPNet, subnet
ranges := make([][]IPAMLocalHostRangeConf, 0)
ranges = append(ranges, ipam)
i.Ranges = ranges
+ route, err := NewIPAMDefaultRoute(IsIPv6(subnet.IP))
+ if err != nil {
+ return MacVLANConfig{}, err
+ }
+ i.Routes = []IPAMRoute{route}
+ i.PluginType = "host-local"
}
m := MacVLANConfig{
diff --git a/libpod/runtime.go b/libpod/runtime.go
index 713026a9e..d775b55e1 100644
--- a/libpod/runtime.go
+++ b/libpod/runtime.go
@@ -17,6 +17,7 @@ import (
"github.com/containers/common/libimage"
"github.com/containers/common/pkg/config"
+ "github.com/containers/common/pkg/defaultnet"
"github.com/containers/common/pkg/secrets"
"github.com/containers/image/v5/pkg/sysregistriesv2"
is "github.com/containers/image/v5/storage"
@@ -217,8 +218,6 @@ func newRuntimeFromConfig(ctx context.Context, conf *config.Config, options ...R
return nil, err
}
- runtime.libimageEventsShutdown = make(chan bool)
-
return runtime, nil
}
@@ -460,6 +459,11 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (retErr error) {
}
}
+ // If we need to make a default network - do so now.
+ if err := defaultnet.Create(runtime.config.Network.DefaultNetwork, runtime.config.Network.DefaultSubnet, runtime.config.Network.NetworkConfigDir, runtime.config.Engine.StaticDir, runtime.config.Engine.MachineEnabled); err != nil {
+ logrus.Errorf("Failed to created default CNI network: %v", err)
+ }
+
// Set up the CNI net plugin
netPlugin, err := ocicni.InitCNI(runtime.config.Network.DefaultNetwork, runtime.config.Network.NetworkConfigDir, runtime.config.Network.CNIPluginDirs...)
if err != nil {
@@ -701,6 +705,8 @@ var libimageEventsMap = map[libimage.EventType]events.Status{
// events on the libimage.Runtime. The gourtine will be cleaned up implicitly
// when the main() exists.
func (r *Runtime) libimageEvents() {
+ r.libimageEventsShutdown = make(chan bool)
+
toLibpodEventStatus := func(e *libimage.Event) events.Status {
status, found := libimageEventsMap[e.Type]
if !found {
@@ -709,9 +715,8 @@ func (r *Runtime) libimageEvents() {
return status
}
+ eventChannel := r.libimageRuntime.EventChannel()
go func() {
- eventChannel := r.libimageRuntime.EventChannel()
-
for {
// Make sure to read and write all events before
// checking if we're about to shutdown.
@@ -780,7 +785,9 @@ func (r *Runtime) Shutdown(force bool) error {
// attempt to shut it down
if r.store != nil {
// Wait for the events to be written.
- r.libimageEventsShutdown <- true
+ if r.libimageEventsShutdown != nil {
+ r.libimageEventsShutdown <- true
+ }
// Note that the libimage runtime shuts down the store.
if err := r.libimageRuntime.Shutdown(force); err != nil {
diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go
index 4e4b2a8ab..6c69d1b72 100644
--- a/libpod/runtime_ctr.go
+++ b/libpod/runtime_ctr.go
@@ -581,6 +581,15 @@ func (r *Runtime) removeContainer(ctx context.Context, c *Container, force, remo
if err := c.stop(c.StopTimeout()); err != nil && errors.Cause(err) != define.ErrConmonDead {
return errors.Wrapf(err, "cannot remove container %s as it could not be stopped", c.ID())
}
+
+ // We unlocked as part of stop() above - there's a chance someone
+ // else got in and removed the container before we reacquired the
+ // lock.
+ // Do a quick ping of the database to check if the container
+ // still exists.
+ if ok, _ := r.state.HasContainer(c.ID()); !ok {
+ return nil
+ }
}
// Remove all active exec sessions
diff --git a/pkg/api/handlers/compat/containers_create.go b/pkg/api/handlers/compat/containers_create.go
index 162a98135..8e9e1fb39 100644
--- a/pkg/api/handlers/compat/containers_create.go
+++ b/pkg/api/handlers/compat/containers_create.go
@@ -62,7 +62,7 @@ func CreateContainer(w http.ResponseWriter, r *http.Request) {
}
// Take body structure and convert to cliopts
- cliOpts, args, err := common.ContainerCreateToContainerCLIOpts(body, rtc.Engine.CgroupManager)
+ cliOpts, args, err := common.ContainerCreateToContainerCLIOpts(body, rtc)
if err != nil {
utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrap(err, "make cli opts()"))
return
diff --git a/pkg/machine/qemu/machine.go b/pkg/machine/qemu/machine.go
index 269a2a2da..0bd711c90 100644
--- a/pkg/machine/qemu/machine.go
+++ b/pkg/machine/qemu/machine.go
@@ -408,7 +408,7 @@ func (v *MachineVM) SSH(name string, opts machine.SSHOptions) error {
sshDestination := v.RemoteUsername + "@localhost"
port := strconv.Itoa(v.Port)
- args := []string{"-i", v.IdentityPath, "-p", port, sshDestination}
+ args := []string{"-i", v.IdentityPath, "-p", port, sshDestination, "-o", "UserKnownHostsFile /dev/null", "-o", "StrictHostKeyChecking no"}
if len(opts.Args) > 0 {
args = append(args, opts.Args...)
} else {
diff --git a/pkg/specgen/generate/kube/kube.go b/pkg/specgen/generate/kube/kube.go
index 054388384..fb563f935 100644
--- a/pkg/specgen/generate/kube/kube.go
+++ b/pkg/specgen/generate/kube/kube.go
@@ -12,6 +12,7 @@ import (
"github.com/containers/common/pkg/secrets"
ann "github.com/containers/podman/v3/pkg/annotations"
"github.com/containers/podman/v3/pkg/specgen"
+ "github.com/containers/podman/v3/pkg/specgen/generate"
"github.com/containers/podman/v3/pkg/util"
spec "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
@@ -182,6 +183,19 @@ func ToSpecGen(ctx context.Context, opts *CtrSpecGenOptions) (*specgen.SpecGener
if imageData.Config.WorkingDir != "" {
s.WorkDir = imageData.Config.WorkingDir
}
+ if s.User == "" {
+ s.User = imageData.Config.User
+ }
+
+ exposed, err := generate.GenExposedPorts(imageData.Config.ExposedPorts)
+ if err != nil {
+ return nil, err
+ }
+
+ for k, v := range s.Expose {
+ exposed[k] = v
+ }
+ s.Expose = exposed
// Pull entrypoint and cmd from image
s.Entrypoint = imageData.Config.Entrypoint
s.Command = imageData.Config.Cmd
diff --git a/pkg/specgen/generate/namespaces.go b/pkg/specgen/generate/namespaces.go
index 278f35c22..f41186ae4 100644
--- a/pkg/specgen/generate/namespaces.go
+++ b/pkg/specgen/generate/namespaces.go
@@ -66,7 +66,7 @@ func GetDefaultNamespaceMode(nsType string, cfg *config.Config, pod *libpod.Pod)
case "cgroup":
return specgen.ParseCgroupNamespace(cfg.Containers.CgroupNS)
case "net":
- ns, _, err := specgen.ParseNetworkNamespace(cfg.Containers.NetNS)
+ ns, _, err := specgen.ParseNetworkNamespace(cfg.Containers.NetNS, cfg.Containers.RootlessNetworking == "cni")
return ns, err
}
diff --git a/pkg/specgen/generate/ports.go b/pkg/specgen/generate/ports.go
index 6832664a7..8745f0dad 100644
--- a/pkg/specgen/generate/ports.go
+++ b/pkg/specgen/generate/ports.go
@@ -268,31 +268,18 @@ func createPortMappings(ctx context.Context, s *specgen.SpecGenerator, imageData
logrus.Debugf("Adding exposed ports")
- // We need to merge s.Expose into image exposed ports
expose := make(map[uint16]string)
- for k, v := range s.Expose {
- expose[k] = v
- }
if imageData != nil {
- for imgExpose := range imageData.Config.ExposedPorts {
- // Expose format is portNumber[/protocol]
- splitExpose := strings.SplitN(imgExpose, "/", 2)
- num, err := strconv.Atoi(splitExpose[0])
- if err != nil {
- return nil, errors.Wrapf(err, "unable to convert image EXPOSE statement %q to port number", imgExpose)
- }
- if num > 65535 || num < 1 {
- return nil, errors.Errorf("%d from image EXPOSE statement %q is not a valid port number", num, imgExpose)
- }
- // No need to validate protocol, we'll do it below.
- if len(splitExpose) == 1 {
- expose[uint16(num)] = "tcp"
- } else {
- expose[uint16(num)] = splitExpose[1]
- }
+ expose, err = GenExposedPorts(imageData.Config.ExposedPorts)
+ if err != nil {
+ return nil, err
}
}
+ // We need to merge s.Expose into image exposed ports
+ for k, v := range s.Expose {
+ expose[k] = v
+ }
// There's been a request to expose some ports. Let's do that.
// Start by figuring out what needs to be exposed.
// This is a map of container port number to protocols to expose.
@@ -417,3 +404,25 @@ func checkProtocol(protocol string, allowSCTP bool) ([]string, error) {
return finalProto, nil
}
+
+func GenExposedPorts(exposedPorts map[string]struct{}) (map[uint16]string, error) {
+ expose := make(map[uint16]string)
+ for imgExpose := range exposedPorts {
+ // Expose format is portNumber[/protocol]
+ splitExpose := strings.SplitN(imgExpose, "/", 2)
+ num, err := strconv.Atoi(splitExpose[0])
+ if err != nil {
+ return nil, errors.Wrapf(err, "unable to convert image EXPOSE statement %q to port number", imgExpose)
+ }
+ if num > 65535 || num < 1 {
+ return nil, errors.Errorf("%d from image EXPOSE statement %q is not a valid port number", num, imgExpose)
+ }
+ // No need to validate protocol, we'll do it below.
+ if len(splitExpose) == 1 {
+ expose[uint16(num)] = "tcp"
+ } else {
+ expose[uint16(num)] = splitExpose[1]
+ }
+ }
+ return expose, nil
+}
diff --git a/pkg/specgen/namespaces.go b/pkg/specgen/namespaces.go
index f665fc0be..80852930a 100644
--- a/pkg/specgen/namespaces.go
+++ b/pkg/specgen/namespaces.go
@@ -253,7 +253,7 @@ func ParseUserNamespace(ns string) (Namespace, error) {
// ParseNetworkNamespace parses a network namespace specification in string
// form.
// Returns a namespace and (optionally) a list of CNI networks to join.
-func ParseNetworkNamespace(ns string) (Namespace, []string, error) {
+func ParseNetworkNamespace(ns string, rootlessDefaultCNI bool) (Namespace, []string, error) {
toReturn := Namespace{}
var cniNetworks []string
// Net defaults to Slirp on rootless
@@ -264,7 +264,11 @@ func ParseNetworkNamespace(ns string) (Namespace, []string, error) {
toReturn.NSMode = FromPod
case ns == "" || ns == string(Default) || ns == string(Private):
if rootless.IsRootless() {
- toReturn.NSMode = Slirp
+ if rootlessDefaultCNI {
+ toReturn.NSMode = Bridge
+ } else {
+ toReturn.NSMode = Slirp
+ }
} else {
toReturn.NSMode = Bridge
}
diff --git a/test/e2e/logs_test.go b/test/e2e/logs_test.go
index 3051031a5..4d9cbb48b 100644
--- a/test/e2e/logs_test.go
+++ b/test/e2e/logs_test.go
@@ -163,7 +163,7 @@ var _ = Describe("Podman logs", func() {
})
It("podman logs on a created container should result in 0 exit code: "+log, func() {
- session := podmanTest.Podman([]string{"create", "-t", "--name", "log", ALPINE})
+ session := podmanTest.Podman([]string{"create", "--log-driver", log, "-t", "--name", "log", ALPINE})
session.WaitWithDefaultTimeout()
Expect(session).To(Exit(0))
diff --git a/test/e2e/network_test.go b/test/e2e/network_test.go
index 6f28d7e19..a7e61932e 100644
--- a/test/e2e/network_test.go
+++ b/test/e2e/network_test.go
@@ -533,7 +533,11 @@ var _ = Describe("Podman network", func() {
out, err := inspect.jq(".[0].plugins[0].master")
Expect(err).To(BeNil())
- Expect(out).To(Equal("\"lo\""))
+ Expect(out).To(Equal(`"lo"`))
+
+ ipamType, err := inspect.jq(".[0].plugins[0].ipam.type")
+ Expect(err).To(BeNil())
+ Expect(ipamType).To(Equal(`"dhcp"`))
nc = podmanTest.Podman([]string{"network", "rm", net})
nc.WaitWithDefaultTimeout()
@@ -571,13 +575,29 @@ var _ = Describe("Podman network", func() {
Expect(err).To(BeNil())
Expect(mtu).To(Equal("1500"))
+ name, err := inspect.jq(".[0].plugins[0].type")
+ Expect(err).To(BeNil())
+ Expect(name).To(Equal(`"macvlan"`))
+
+ netInt, err := inspect.jq(".[0].plugins[0].master")
+ Expect(err).To(BeNil())
+ Expect(netInt).To(Equal(`"lo"`))
+
+ ipamType, err := inspect.jq(".[0].plugins[0].ipam.type")
+ Expect(err).To(BeNil())
+ Expect(ipamType).To(Equal(`"host-local"`))
+
gw, err := inspect.jq(".[0].plugins[0].ipam.ranges[0][0].gateway")
Expect(err).To(BeNil())
- Expect(gw).To(Equal("\"192.168.1.254\""))
+ Expect(gw).To(Equal(`"192.168.1.254"`))
subnet, err := inspect.jq(".[0].plugins[0].ipam.ranges[0][0].subnet")
Expect(err).To(BeNil())
- Expect(subnet).To(Equal("\"192.168.1.0/24\""))
+ Expect(subnet).To(Equal(`"192.168.1.0/24"`))
+
+ routes, err := inspect.jq(".[0].plugins[0].ipam.routes[0].dst")
+ Expect(err).To(BeNil())
+ Expect(routes).To(Equal(`"0.0.0.0/0"`))
nc = podmanTest.Podman([]string{"network", "rm", net})
nc.WaitWithDefaultTimeout()
diff --git a/test/e2e/run_device_test.go b/test/e2e/run_device_test.go
index 3137e3fe4..735e44d3e 100644
--- a/test/e2e/run_device_test.go
+++ b/test/e2e/run_device_test.go
@@ -113,4 +113,10 @@ var _ = Describe("Podman run device", func() {
Expect(session.ExitCode()).To(Equal(0))
Expect(session.OutputToString()).To(Equal("/dev/kmsg1"))
})
+
+ It("podman run --gpus noop", func() {
+ session := podmanTest.Podman([]string{"run", "--gpus", "all", ALPINE, "ls", "/"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ })
})
diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go
index 37e837b1d..696cec76c 100644
--- a/test/e2e/run_networking_test.go
+++ b/test/e2e/run_networking_test.go
@@ -786,4 +786,18 @@ var _ = Describe("Podman run networking", func() {
Expect(session.ExitCode()).To(BeZero())
Expect(session.OutputToString()).To(ContainSubstring("search dns.podman"))
})
+
+ It("Rootless podman run with --net=bridge works and connects to default network", func() {
+ // This is harmless when run as root, so we'll just let it run.
+ ctrName := "testctr"
+ ctr := podmanTest.Podman([]string{"run", "-d", "--net=bridge", "--name", ctrName, ALPINE, "top"})
+ ctr.WaitWithDefaultTimeout()
+ Expect(ctr.ExitCode()).To(BeZero())
+
+ inspectOut := podmanTest.InspectContainer(ctrName)
+ Expect(len(inspectOut)).To(Equal(1))
+ Expect(len(inspectOut[0].NetworkSettings.Networks)).To(Equal(1))
+ _, ok := inspectOut[0].NetworkSettings.Networks["podman"]
+ Expect(ok).To(BeTrue())
+ })
})
diff --git a/test/system/035-logs.bats b/test/system/035-logs.bats
index 3dd88e5eb..ccf83df14 100644
--- a/test/system/035-logs.bats
+++ b/test/system/035-logs.bats
@@ -73,4 +73,56 @@ ${cid[0]} d" "Sequential output from logs"
_log_test_multi journald
}
+@test "podman logs - journald log driver requires journald events backend" {
+ skip_if_remote "remote does not support --events-backend"
+ # We can't use journald on RHEL as rootless: rhbz#1895105
+ skip_if_journald_unavailable
+
+ run_podman --events-backend=file run --log-driver=journald -d --name test --replace $IMAGE ls /
+ run_podman --events-backend=file logs test
+ run_podman 125 --events-backend=file logs --follow test
+ is "$output" "Error: using --follow with the journald --log-driver but without the journald --events-backend (file) is not supported" "journald logger requires journald eventer"
+}
+
+function _log_test_since() {
+ local driver=$1
+
+ s_before="before_$(random_string)_${driver}"
+ s_after="after_$(random_string)_${driver}"
+
+ before=$(date --iso-8601=seconds)
+ run_podman run --log-driver=$driver -d --name test $IMAGE sh -c \
+ "echo $s_before; trap 'echo $s_after; exit' SIGTERM; while :; do sleep 1; done"
+
+ # sleep a second to make sure the date is after the first echo
+ sleep 1
+ after=$(date --iso-8601=seconds)
+ run_podman stop test
+
+ run_podman logs test
+ is "$output" \
+ "$s_before
+$s_after"
+
+ run_podman logs --since $before test
+ is "$output" \
+ "$s_before
+$s_after"
+
+ run_podman logs --since $after test
+ is "$output" "$s_after"
+ run_podman rm -f test
+}
+
+@test "podman logs - since k8s-file" {
+ _log_test_since k8s-file
+}
+
+@test "podman logs - since journald" {
+ # We can't use journald on RHEL as rootless: rhbz#1895105
+ skip_if_journald_unavailable
+
+ _log_test_since journald
+}
+
# vim: filetype=sh
diff --git a/test/system/130-kill.bats b/test/system/130-kill.bats
index 1b02b4976..3770eac27 100644
--- a/test/system/130-kill.bats
+++ b/test/system/130-kill.bats
@@ -8,8 +8,7 @@ load helpers
@test "podman kill - test signal handling in containers" {
# Start a container that will handle all signals by emitting 'got: N'
local -a signals=(1 2 3 4 5 6 8 10 12 13 14 15 16 20 21 22 23 24 25 26 64)
- # Force the k8s-file driver until #10323 is fixed.
- run_podman run --log-driver=k8s-file -d $IMAGE sh -c \
+ run_podman run -d $IMAGE sh -c \
"for i in ${signals[*]}; do trap \"echo got: \$i\" \$i; done;
echo READY;
while ! test -e /stop; do sleep 0.05; done;
diff --git a/test/system/700-play.bats b/test/system/700-play.bats
index bcd8cf939..15f3e240a 100644
--- a/test/system/700-play.bats
+++ b/test/system/700-play.bats
@@ -88,3 +88,44 @@ RELABEL="system_u:object_r:container_file_t:s0"
fi
run_podman pod rm -f test_pod
}
+
+@test "podman play with user from image" {
+ TESTDIR=$PODMAN_TMPDIR/testdir
+ mkdir -p $TESTDIR
+
+testUserYaml="
+apiVersion: v1
+kind: Pod
+metadata:
+ labels:
+ app: test
+ name: test_pod
+spec:
+ containers:
+ - command:
+ - id
+ env:
+ - name: PATH
+ value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+ - name: TERM
+ value: xterm
+ - name: container
+ value: podman
+ image: userimage
+ name: test
+ resources: {}
+status: {}
+"
+
+cat > $PODMAN_TMPDIR/Containerfile << _EOF
+from $IMAGE
+USER bin
+_EOF
+
+ echo "$testUserYaml" | sed "s|TESTDIR|${TESTDIR}|g" > $PODMAN_TMPDIR/test.yaml
+ run_podman build -t userimage $PODMAN_TMPDIR
+ run_podman play kube --start=false $PODMAN_TMPDIR/test.yaml
+ run_podman inspect --format "{{ .Config.User }}" test_pod-test
+ is "$output" bin "expect container within pod to run as the bin user"
+ run_podman pod rm -f test_pod
+}
diff --git a/transfer.md b/transfer.md
index 8ead43f63..c37592384 100644
--- a/transfer.md
+++ b/transfer.md
@@ -9,7 +9,7 @@ This document outlines useful information for ops and dev transfer as it relates
Podman is a tool for managing Pods, Containers, and Container Images. The CLI
for Podman is based on the Docker CLI, although Podman does not require a
-runtime daemon to be running in order to function.
+runtime daemon to be running in order to function. Podman also supports the Docker API via the Podman socket activated system service.
## System Tools
@@ -21,81 +21,94 @@ As well as some systemd helpers like `systemd-cgls` and `systemd-cgtop` are stil
For many troubleshooting and information collection steps, there may be an existing pattern.
Following provides equivalent with `Podman` tools for gathering information or jumping into containers, for operational use.
-| Existing Step | `Podman` (and friends) |
-| :--- | :--- |
-| `docker run` | [`podman run`](./docs/source/markdown/podman-run.1.md) |
-| `docker exec` | [`podman exec`](./docs/source/markdown/podman-exec.1.md) |
-| `docker info` | [`podman info`](./docs/source/markdown/podman-info.1.md) |
-| `docker inspect` | [`podman inspect`](./docs/source/markdown/podman-inspect.1.md) |
-| `docker logs` | [`podman logs`](./docs/source/markdown/podman-logs.1.md) |
-| `docker ps` | [`podman ps`](./docs/source/markdown/podman-ps.1.md) |
-| `docker stats`| [`podman stats`](./docs/source/markdown/podman-stats.1.md)|
-
## Development Transfer
There are other equivalents for these tools
| Existing Step | `Podman` (and friends) |
| :--- | :--- |
+| `docker ` | [`podman`](./docs/source/markdown/podman.1.md) |
| `docker attach` | [`podman attach`](./docs/source/markdown/podman-attach.1.md) |
+| `docker auto-update`|[`podman auto-update`](./docs/source/markdown/podman-auto-update.1.md)|
| `docker build` | [`podman build`](./docs/source/markdown/podman-build.1.md) |
| `docker commit` | [`podman commit`](./docs/source/markdown/podman-commit.1.md) |
-| `docker container`|[`podman container`](./docs/source/markdown/podman-container.1.md) |
+| `docker container `|[`podman container`](./docs/source/markdown/podman-container.1.md) |
+| `docker container prune`|[`podman container prune`](./docs/source/markdown/podman-container-prune.1.md) |
| `docker cp` | [`podman cp`](./docs/source/markdown/podman-cp.1.md) |
| `docker create` | [`podman create`](./docs/source/markdown/podman-create.1.md) |
| `docker diff` | [`podman diff`](./docs/source/markdown/podman-diff.1.md) |
| `docker events` | [`podman events`](./docs/source/markdown/podman-events.1.md) |
+| `docker exec` | [`podman exec`](./docs/source/markdown/podman-exec.1.md) |
| `docker export` | [`podman export`](./docs/source/markdown/podman-export.1.md) |
| `docker history` | [`podman history`](./docs/source/markdown/podman-history.1.md) |
-| `docker image` | [`podman image`](./docs/source/markdown/podman-image.1.md) |
+| `docker image` | [`podman image`](./docs/source/markdown/podman-image.1.md) |
| `docker images` | [`podman images`](./docs/source/markdown/podman-images.1.md) |
| `docker import` | [`podman import`](./docs/source/markdown/podman-import.1.md) |
+| `docker info` | [`podman info`](./docs/source/markdown/podman-info.1.md) |
+| `docker inspect` | [`podman inspect`](./docs/source/markdown/podman-inspect.1.md) |
| `docker kill` | [`podman kill`](./docs/source/markdown/podman-kill.1.md) |
| `docker load` | [`podman load`](./docs/source/markdown/podman-load.1.md) |
| `docker login` | [`podman login`](./docs/source/markdown/podman-login.1.md) |
| `docker logout` | [`podman logout`](./docs/source/markdown/podman-logout.1.md) |
-| `docker network create` | [`podman network create`](./docs/source/markdown/podman-network-create.1.md) |
-| `docker network inspect` | [`podman network inspect`](./docs/source/markdown/podman-network-inspect.1.md) |
-| `docker network ls` | [`podman network ls`](./docs/source/markdown/podman-network-ls.1.md) |
-| `docker network rm` | [`podman network rm`](./docs.source/markdown/podman-network-rm.1.md) |
+| `docker logs` | [`podman logs`](./docs/source/markdown/podman-logs.1.md) |
+| `docker manifest `| [`podman manifest`](./docs.source/markdown/podman-manifest.1.md) |
+| `docker manifest annotate` | [`podman manifest annotate`](./docs/source/markdown/podman-manifest-annotate.1.md) |
+| `docker manifest create` | [`podman manifest create`](./docs/source/markdown/podman-manifest-create.1.md) |
+| `docker manifest inspect`| [`podman manifest inspect`](./docs/source/markdown/podman-manifest-inspect.1.md) |
+| `docker manifest push` | [`podman manifest push`](./docs/source/markdown/podman-manifest-push.1.md) |
+| `docker manifest rm` | [`podman manifest rm`](./docs.source/markdown/podman-manifest-rm.1.md) |
+| `docker network ` | [`podman network`](./docs.source/markdown/podman-network.1.md) |
+| `docker network connect` | [`podman network connect`](./docs/source/markdown/podman-network-connect.1.md) |
+| `docker network create` | [`podman network create`](./docs/source/markdown/podman-network-create.1.md) |
+| `docker network disconnect`| [`podman network disconnect`](./docs/source/markdown/podman-network-disconnect.1.md)|
+| `docker network inspect` | [`podman network inspect`](./docs/source/markdown/podman-network-inspect.1.md) |
+| `docker network ls` | [`podman network ls`](./docs/source/markdown/podman-network-ls.1.md) |
+| `docker network rm` | [`podman network rm`](./docs.source/markdown/podman-network-rm.1.md) |
| `docker pause` | [`podman pause`](./docs/source/markdown/podman-pause.1.md) |
| `docker port` | [`podman port`](./docs/source/markdown/podman-port.1.md) |
| `docker ps` | [`podman ps`](./docs/source/markdown/podman-ps.1.md) |
| `docker pull` | [`podman pull`](./docs/source/markdown/podman-pull.1.md) |
| `docker push` | [`podman push`](./docs/source/markdown/podman-push.1.md) |
+| `docker rename` | [`podman rename`](./docs/source/markdown/podman-rename.1.md) |
| `docker restart` | [`podman restart`](./docs/source/markdown/podman-restart.1.md) |
| `docker rm` | [`podman rm`](./docs/source/markdown/podman-rm.1.md) |
| `docker rmi` | [`podman rmi`](./docs/source/markdown/podman-rmi.1.md) |
| `docker run` | [`podman run`](./docs/source/markdown/podman-run.1.md) |
| `docker save` | [`podman save`](./docs/source/markdown/podman-save.1.md) |
| `docker search` | [`podman search`](./docs/source/markdown/podman-search.1.md) |
+| `docker secret ` | [`podman secret`](./docs/source/markdown/podman-secret.1.md) |
+| `docker secret create` | [`podman secret`](./docs/source/markdown/podman-secret-create.1.md) |
+| `docker secret inspect` | [`podman secret`](./docs/source/markdown/podman-secret-inspect.1.md)|
+| `docker secret ls` | [`podman secret`](./docs/source/markdown/podman-secret-ls.1.md)|
+| `docker secret rm` | [`podman secret`](./docs/source/markdown/podman-secret-rm.1.md)|
+| `docker service` | [`podman service`](./docs/source/markdown/podman-service.1.md) |
| `docker start` | [`podman start`](./docs/source/markdown/podman-start.1.md) |
+| `docker stats` | [`podman stats`](./docs/source/markdown/podman-stats.1.md) |
| `docker stop` | [`podman stop`](./docs/source/markdown/podman-stop.1.md) |
-| `docker system df` | [`podman system df`](./docs/source/markdown/podman-system-df.1.md) |
-| `docker system info` | [`podman system info`](./docs/source/markdown/podman-system-info.1.md) |
-| `docker system prune` | [`podman system prune`](./docs/source/markdown/podman-system-prune.1.md) |
-| `docker system` | [`podman system`](./docs/source/markdown/podman-system.1.md) |
+| `docker system ` | [`podman system`](./docs/source/markdown/podman-system.1.md) |
+| `docker system df` | [`podman system df`](./docs/source/markdown/podman-system-df.1.md) |
+| `docker system info` | [`podman system info`](./docs/source/markdown/podman-system-info.1.md) |
+| `docker system prune` | [`podman system prune`](./docs/source/markdown/podman-system-prune.1.md)|
| `docker tag` | [`podman tag`](./docs/source/markdown/podman-tag.1.md) |
| `docker top` | [`podman top`](./docs/source/markdown/podman-top.1.md) |
| `docker unpause` | [`podman unpause`](./docs/source/markdown/podman-unpause.1.md) |
| `docker version` | [`podman version`](./docs/source/markdown/podman-version.1.md) |
+| `docker volume `| [`podman volume`](./docs/source/markdown/podman-volume.1.md) |
| `docker volume create` | [`podman volume create`](./docs/source/markdown/podman-volume-create.1.md) |
| `docker volume inspect`| [`podman volume inspect`](./docs/source/markdown/podman-volume-inspect.1.md)|
| `docker volume ls` | [`podman volume ls`](./docs/source/markdown/podman-volume-ls.1.md) |
| `docker volume prune` | [`podman volume prune`](./docs/source/markdown/podman-volume-prune.1.md) |
| `docker volume rm` | [`podman volume rm`](./docs/source/markdown/podman-volume-rm.1.md) |
-| `docker volume` | [`podman volume`](./docs/source/markdown/podman-volume.1.md) |
| `docker wait` | [`podman wait`](./docs/source/markdown/podman-wait.1.md) |
-**** Use mount to take advantage of the entire linux tool chain rather then just cp. Read [`here`](./docs/podman-cp.1.md) for more information.
-
## Behavioural differences and pitfalls
These commands behave differently from the commands in Docker:
| Command | Description |
| :--- | :--- |
-| `podman volume create` | While `docker volume create` is idempotent, `podman volume create` raises an error if the volume does already exist. See this [docker issue](https://github.com/moby/moby/issues/16068) for more information.|
+| `podman volume create` | While `docker volume create` is idempotent, `podman volume create` raises an error if the volume does already exist. See this [docker issue](https://github.com/moby/moby/issues/16068) for more information.|
+| `podman run -v /tmp/noexist:/tmp ...` | While `docker run -v /tmp/noexist:/tmp` will create non existing volumes on the host, Podman will report that the volume does not exist. The Podman team sees this as a bug in Docker.|
## Missing commands in podman
@@ -103,14 +116,17 @@ Those Docker commands currently do not have equivalents in `podman`:
| Missing command | Description|
| :--- | :--- |
-| `docker container rename` | podman does not support `container rename` - or the `rename` shorthand. We recommend using `podman rm` and `podman create` to create a container with a specific name.|
+| `docker builder` ||
+| `docker buildx` ||
+| `docker config` ||
+| `docker context` ||
| `docker container update` | podman does not support altering running containers. We recommend recreating containers with the correct arguments.|
| `docker node` ||
| `docker plugin` | podman does not support plugins. We recommend you use alternative OCI Runtimes or OCI Runtime Hooks to alter behavior of podman.|
-| `docker secret` ||
-| `docker service` ||
| `docker stack` ||
| `docker swarm` | podman does not support swarm. We support Kubernetes for orchestration using [CRI-O](https://github.com/cri-o/cri-o).|
+| `docker trust` |[`podman image trust`](./docs/source/markdown/podman-image-trust.1.md) |
+| `docker update` ||
## Missing commands in Docker
@@ -122,26 +138,62 @@ The following podman commands do not have a Docker equivalent:
* [`podman container refresh`](/docs/source/markdown/podman-container-refresh.1.md)
* [`podman container restore`](/docs/source/markdown/podman-container-restore.1.md)
* [`podman container runlabel`](/docs/source/markdown/podman-container-runlabel.1.md)
+* [`podman generate `](./docs/source/markdown/podman-generate.1.md)
* [`podman generate kube`](./docs/source/markdown/podman-generate-kube.1.md)
-* [`podman generate`](./docs/source/markdown/podman-generate.1.md)
-* [`podman healthcheck run`](/docs/source/markdown/podman-healthcheck-run.1.md)
+* [`podman generate systemd`](./docs/source/markdown/podman-generate-systemd.1.md)
+* [`podman healthcheck `](/docs/source/markdown/podmanh-healthcheck.1.md)
+* [`podman healthcheck run`](/docs/source/markdown/podmanh-healthcheck-run.1.md)
+* [`podman image diff`](./docs/source/markdown/podman-image-diff.1.md)
* [`podman image exists`](./docs/source/markdown/podman-image-exists.1.md)
+* [`podman image mount`](./docs/source/markdown/podman-image-mount.1.md)
+* [`podman image prune`](./docs/source/markdown/podman-image-prune.1.md)
* [`podman image sign`](./docs/source/markdown/podman-image-sign.1.md)
+* [`podman image tree`](./docs/source/markdown/podman-image-tree.1.md)
* [`podman image trust`](./docs/source/markdown/podman-image-trust.1.md)
+* [`podman image unmount`](./docs/source/markdown/podman-image-unmount.1.md)
+* [`podman init`](./docs/source/markdown/podman-init.1.md)
+* [`podman machine `](./docs/source/markdown/podman-machine.1.md)
+* [`podman machine init`](./docs/source/markdown/podman-machine-init.1.md)
+* [`podman machine list`](./docs/source/markdown/podman-machine-list.1.md)
+* [`podman machine rm`](./docs/source/markdown/podman-machine-rm.1.md)
+* [`podman machine ssh`](./docs/source/markdown/podman-machine-ssh.1.md)
+* [`podman machine start`](./docs/source/markdown/podman-machine-start.1.md)
+* [`podman machine stop`](./docs/source/markdown/podman-machine-stop.1.md)
+* [`podman manifest add`](./docs/source/markdown/podman-manifest-add.1.md)
+* [`podman manifest exists`](./docs/source/markdown/podman-manifest-exists.1.md)
+* [`podman manifest remove`](./docs/source/markdown/podman-manifest-remove.1.md)
* [`podman mount`](./docs/source/markdown/podman-mount.1.md)
+* [`podman network exists`](./docs/source/markdown/podman-network-exists.1.md)
+* [`podman network prune`](./docs/source/markdown/podman-network-prune.1.md)
+* [`podman network reload`](./docs/source/markdown/podman-network-reload.1.md)
+* [`podman play `](./docs/source/markdown/podman-play.1.md)
* [`podman play kube`](./docs/source/markdown/podman-play-kube.1.md)
-* [`podman play`](./docs/source/markdown/podman-play.1.md)
+* [`podman pod `](./docs/source/markdown/podman-pod.1.md)
* [`podman pod create`](./docs/source/markdown/podman-pod-create.1.md)
* [`podman pod exists`](./docs/source/markdown/podman-pod-exists.1.md)
* [`podman pod inspect`](./docs/source/markdown/podman-pod-inspect.1.md)
* [`podman pod kill`](./docs/source/markdown/podman-pod-kill.1.md)
* [`podman pod pause`](./docs/source/markdown/podman-pod-pause.1.md)
+* [`podman pod prune`](./docs/source/markdown/podman-pod-prune.1.md)
* [`podman pod ps`](./docs/source/markdown/podman-pod-ps.1.md)
* [`podman pod restart`](./docs/source/markdown/podman-pod-restart.1.md)
* [`podman pod rm`](./docs/source/markdown/podman-pod-rm.1.md)
* [`podman pod start`](./docs/source/markdown/podman-pod-start.1.md)
+* [`podman pod stats`](./docs/source/markdown/podman-pod-stats.1.md)
* [`podman pod stop`](./docs/source/markdown/podman-pod-stop.1.md)
* [`podman pod top`](./docs/source/markdown/podman-pod-top.1.md)
* [`podman pod unpause`](./docs/source/markdown/podman-pod-unpause.1.md)
-* [`podman pod`](./docs/source/markdown/podman-pod.1.md)
+* [`podman system connection `](./docs/source/markdown/podman-system-connection.1.md)
+* [`podman system connection add`](./docs/source/markdown/podman-system-connection-add.1.md)
+* [`podman system connection default`](./docs/source/markdown/podman-system-connection-default.1.md)
+* [`podman system connection list`](./docs/source/markdown/podman-system-connection-list.1.md)
+* [`podman system connection remove`](./docs/source/markdown/podman-system-connection-remove.1.md)
+* [`podman system connection rename`](./docs/source/markdown/podman-system-connection-rename.1.md)
+* [`podman system migrate`](./docs/source/markdown/podman-system-connection-migrate.1.md)
+* [`podman system renumber`](./docs/source/markdown/podman-system-connection-renumber.1.md)
+* [`podman system reset`](./docs/source/markdown/podman-system-connection-reset.1.md)
+* [`podman system service`](./docs/source/markdown/podman-system-connection-service.1.md)
* [`podman umount`](./docs/source/markdown/podman-umount.1.md)
+* [`podman unshare`](./docs/source/markdown/podman-unshare.1.md)
+* [`podman untag`](./docs/source/markdown/podman-untag.1.md)
+* [`podman volume exists`](./docs/source/markdown/podman-volume-exists.1.md)
diff --git a/vendor/github.com/containers/common/libimage/image.go b/vendor/github.com/containers/common/libimage/image.go
index 1f76d4ae5..de0b4b2c5 100644
--- a/vendor/github.com/containers/common/libimage/image.go
+++ b/vendor/github.com/containers/common/libimage/image.go
@@ -658,25 +658,6 @@ func (i *Image) Unmount(force bool) error {
return err
}
-// MountPoint returns the fully-evaluated mount point of the image. If the
-// image isn't mounted, an empty string is returned.
-func (i *Image) MountPoint() (string, error) {
- counter, err := i.runtime.store.Mounted(i.TopLayer())
- if err != nil {
- return "", err
- }
-
- if counter == 0 {
- return "", nil
- }
-
- layer, err := i.runtime.store.Layer(i.TopLayer())
- if err != nil {
- return "", err
- }
- return filepath.EvalSymlinks(layer.MountPoint)
-}
-
// Size computes the size of the image layers and associated data.
func (i *Image) Size() (int64, error) {
return i.runtime.store.ImageSize(i.ID())
diff --git a/vendor/github.com/containers/common/libimage/pull.go b/vendor/github.com/containers/common/libimage/pull.go
index d93715279..5fa888251 100644
--- a/vendor/github.com/containers/common/libimage/pull.go
+++ b/vendor/github.com/containers/common/libimage/pull.go
@@ -279,6 +279,7 @@ func (r *Runtime) copyFromRegistry(ctx context.Context, ref types.ImageReference
return r.copySingleImageFromRegistry(ctx, inputName, pullPolicy, options)
}
+ // Copy all tags
named := reference.TrimNamed(ref.DockerReference())
tags, err := registryTransport.GetRepositoryTags(ctx, &r.systemContext, ref)
if err != nil {
diff --git a/vendor/github.com/containers/common/libimage/runtime.go b/vendor/github.com/containers/common/libimage/runtime.go
index 422cd6069..aa798d008 100644
--- a/vendor/github.com/containers/common/libimage/runtime.go
+++ b/vendor/github.com/containers/common/libimage/runtime.go
@@ -516,8 +516,9 @@ type RemoveImagesOptions struct {
WithSize bool
}
-// RemoveImages removes images specified by names. All images are expected to
-// exist in the local containers storage.
+// RemoveImages removes images specified by names. If no names are specified,
+// remove images as specified via the options' filters. All images are
+// expected to exist in the local containers storage.
//
// If an image has more names than one name, the image will be untagged with
// the specified name. RemoveImages returns a slice of untagged and removed
@@ -557,6 +558,9 @@ func (r *Runtime) RemoveImages(ctx context.Context, names []string, options *Rem
// orderedIDs and the deleteMap.
switch {
case len(names) > 0:
+ // Look up the images one-by-one. That allows for removing
+ // images that have been looked up successfully while reporting
+ // lookup errors at the end.
lookupOptions := LookupImageOptions{IgnorePlatform: true}
for _, name := range names {
img, resolvedName, err := r.LookupImage(name, &lookupOptions)
diff --git a/vendor/github.com/containers/common/pkg/config/config.go b/vendor/github.com/containers/common/pkg/config/config.go
index 9ac71c6c8..edd52f49d 100644
--- a/vendor/github.com/containers/common/pkg/config/config.go
+++ b/vendor/github.com/containers/common/pkg/config/config.go
@@ -150,6 +150,11 @@ type ContainersConfig struct {
// PidNS indicates how to create a pid namespace for the container
PidNS string `toml:"pidns,omitempty"`
+ // RootlessNetworking depicts the "kind" of networking for rootless
+ // containers. Valid options are `slirp4netns` and `cni`. Default is
+ // `slirp4netns`
+ RootlessNetworking string `toml:"rootless_networking,omitempty"`
+
// SeccompProfile is the seccomp.json profile path which is used as the
// default for the runtime.
SeccompProfile string `toml:"seccomp_profile,omitempty"`
diff --git a/vendor/github.com/containers/common/pkg/config/containers.conf b/vendor/github.com/containers/common/pkg/config/containers.conf
index 8770ebda0..d9b379eae 100644
--- a/vendor/github.com/containers/common/pkg/config/containers.conf
+++ b/vendor/github.com/containers/common/pkg/config/containers.conf
@@ -389,6 +389,9 @@ default_sysctls = [
# `podman --remote=true` for access to the remote Podman service.
# remote = false
+# Indicates the networking to be used for rootless containers
+# rootless_networking="slirp4netns"
+
# Directory for persistent engine files (database, etc)
# By default, this will be configured relative to where the containers/storage
# stores containers
diff --git a/vendor/github.com/containers/common/pkg/config/default.go b/vendor/github.com/containers/common/pkg/config/default.go
index 04aaac94d..2b660d1ab 100644
--- a/vendor/github.com/containers/common/pkg/config/default.go
+++ b/vendor/github.com/containers/common/pkg/config/default.go
@@ -82,6 +82,10 @@ var (
"/usr/local/lib/cni",
"/opt/cni/bin",
}
+
+ // DefaultRootlessNetwork is the kind of of rootless networking
+ // for containers
+ DefaultRootlessNetwork = "slirp4netns"
)
const (
@@ -186,24 +190,25 @@ func DefaultConfig() (*Config, error) {
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"TERM=xterm",
},
- EnvHost: false,
- HTTPProxy: true,
- Init: false,
- InitPath: "",
- IPCNS: "private",
- LogDriver: DefaultLogDriver,
- LogSizeMax: DefaultLogSizeMax,
- NetNS: netns,
- NoHosts: false,
- PidsLimit: DefaultPidsLimit,
- PidNS: "private",
- SeccompProfile: SeccompDefaultPath,
- ShmSize: DefaultShmSize,
- TZ: "",
- Umask: "0022",
- UTSNS: "private",
- UserNS: "host",
- UserNSSize: DefaultUserNSSize,
+ EnvHost: false,
+ HTTPProxy: true,
+ Init: false,
+ InitPath: "",
+ IPCNS: "private",
+ LogDriver: DefaultLogDriver,
+ LogSizeMax: DefaultLogSizeMax,
+ NetNS: netns,
+ NoHosts: false,
+ PidsLimit: DefaultPidsLimit,
+ PidNS: "private",
+ RootlessNetworking: DefaultRootlessNetwork,
+ SeccompProfile: SeccompDefaultPath,
+ ShmSize: DefaultShmSize,
+ TZ: "",
+ Umask: "0022",
+ UTSNS: "private",
+ UserNS: "host",
+ UserNSSize: DefaultUserNSSize,
},
Network: NetworkConfig{
DefaultNetwork: "podman",
@@ -410,9 +415,6 @@ func probeConmon(conmonBinary string) error {
// NetNS returns the default network namespace
func (c *Config) NetNS() string {
- if c.Containers.NetNS == "private" && unshare.IsRootless() {
- return "slirp4netns"
- }
return c.Containers.NetNS
}
@@ -544,3 +546,9 @@ func (c *Config) LogDriver() string {
func (c *Config) MachineEnabled() bool {
return c.Engine.MachineEnabled
}
+
+// RootlessNetworking returns the "kind" of networking
+// rootless containers should use
+func (c *Config) RootlessNetworking() string {
+ return c.Containers.RootlessNetworking
+}
diff --git a/vendor/github.com/containers/common/pkg/defaultnet/default_network.go b/vendor/github.com/containers/common/pkg/defaultnet/default_network.go
new file mode 100644
index 000000000..9b32241d6
--- /dev/null
+++ b/vendor/github.com/containers/common/pkg/defaultnet/default_network.go
@@ -0,0 +1,222 @@
+package defaultnet
+
+import (
+ "bytes"
+ "encoding/json"
+ "fmt"
+ "io/ioutil"
+ "net"
+ "os"
+ "path/filepath"
+ "regexp"
+ "text/template"
+
+ "github.com/pkg/errors"
+ "github.com/sirupsen/logrus"
+)
+
+// TODO: A smarter implementation would make sure cni-podman0 was unused before
+// making the default, and adjust if necessary
+const networkTemplate = `{
+ "cniVersion": "0.4.0",
+ "name": "{{{{.Name}}}}",
+ "plugins": [
+ {
+ "type": "bridge",
+ "bridge": "cni-podman0",
+ "isGateway": true,
+ "ipMasq": true,
+ "hairpinMode": true,
+ "ipam": {
+ "type": "host-local",
+ "routes": [{ "dst": "0.0.0.0/0" }],
+ "ranges": [
+ [
+ {
+ "subnet": "{{{{.Subnet}}}}",
+ "gateway": "{{{{.Gateway}}}}"
+ }
+ ]
+ ]
+ }
+ },
+{{{{- if (eq .Machine true) }}}}
+ {
+ "type": "podman-machine",
+ "capabilities": {
+ "portMappings": true
+ }
+ },
+{{{{- end}}}}
+ {
+ "type": "portmap",
+ "capabilities": {
+ "portMappings": true
+ }
+ },
+ {
+ "type": "firewall"
+ },
+ {
+ "type": "tuning"
+ }
+ ]
+}
+`
+
+var (
+ // Borrowed from Podman, modified to remove dashes and periods.
+ nameRegex = regexp.MustCompile("^[a-zA-Z0-9][a-zA-Z0-9_]*$")
+)
+
+// Used to pass info into the template engine
+type networkInfo struct {
+ Name string
+ Subnet string
+ Gateway string
+ Machine bool
+}
+
+// The most trivial definition of a CNI network possible for our use here.
+// We need the name, and nothing else.
+type network struct {
+ Name string `json:"name"`
+}
+
+// Create makes the CNI default network, if necessary.
+// Accepts the name and subnet of the network to create (a standard template
+// will be used, with these values plugged in), the configuration directory
+// where CNI configs are stored (to verify if a named configuration already
+// exists), an exists directory (where a sentinel file will be stored, to ensure
+// the network is only made once), and an isMachine bool (to determine whether
+// the machine block will be added to the config).
+// Create first checks if a default network has already been created via the
+// presence of a sentinel file. If it does exist, it returns immediately without
+// error.
+// It next checks if a CNI network with the given name already exists. In that
+// case, it creates the sentinel file and returns without error.
+// If neither of these are true, the default network is created.
+func Create(name, subnet, configDir, existsDir string, isMachine bool) error {
+ // TODO: Should probably regex name to make sure it's valid.
+ if name == "" || subnet == "" || configDir == "" || existsDir == "" {
+ return errors.Errorf("must provide values for all arguments to MakeDefaultNetwork")
+ }
+ if !nameRegex.MatchString(name) {
+ return errors.Errorf("invalid default network name %s - letters, numbers, and underscores only", name)
+ }
+
+ sentinelFile := filepath.Join(existsDir, "defaultCNINetExists")
+
+ // Check if sentinel file exists, return immediately if it does.
+ if _, err := os.Stat(sentinelFile); err == nil {
+ return nil
+ }
+
+ // Create the sentinel file if it doesn't exist, so subsequent checks
+ // don't need to go further.
+ file, err := os.Create(sentinelFile)
+ if err != nil {
+ return err
+ }
+ file.Close()
+
+ // We may need to make the config dir.
+ if err := os.MkdirAll(configDir, 0755); err != nil && !os.IsExist(err) {
+ return errors.Wrapf(err, "error creating CNI configuration directory")
+ }
+
+ // Check all networks in the CNI conflist.
+ files, err := ioutil.ReadDir(configDir)
+ if err != nil {
+ return errors.Wrapf(err, "error reading CNI configuration directory")
+ }
+ if len(files) > 0 {
+ configPaths := make([]string, 0, len(files))
+ for _, path := range files {
+ if !path.IsDir() && filepath.Ext(path.Name()) == ".conflist" {
+ configPaths = append(configPaths, filepath.Join(configDir, path.Name()))
+ }
+ }
+ for _, config := range configPaths {
+ configName, err := getConfigName(config)
+ if err != nil {
+ logrus.Errorf("Error reading CNI configuration file: %v", err)
+ continue
+ }
+ if configName == name {
+ return nil
+ }
+ }
+ }
+
+ // We need to make the config.
+ // Get subnet and gateway.
+ _, ipNet, err := net.ParseCIDR(subnet)
+ if err != nil {
+ return errors.Wrapf(err, "default network subnet %s is invalid", subnet)
+ }
+
+ ones, bits := ipNet.Mask.Size()
+ if ones == bits {
+ return errors.Wrapf(err, "default network subnet %s is to small", subnet)
+ }
+ gateway := make(net.IP, len(ipNet.IP))
+ // copy the subnet ip to the gateway so we can modify it
+ copy(gateway, ipNet.IP)
+ // the default gateway should be the first ip in the subnet
+ gateway[len(gateway)-1]++
+
+ netInfo := new(networkInfo)
+ netInfo.Name = name
+ netInfo.Gateway = gateway.String()
+ netInfo.Subnet = ipNet.String()
+ netInfo.Machine = isMachine
+
+ templ, err := template.New("network_template").Delims("{{{{", "}}}}").Parse(networkTemplate)
+ if err != nil {
+ return errors.Wrapf(err, "error compiling template for default network")
+ }
+ var output bytes.Buffer
+ if err := templ.Execute(&output, netInfo); err != nil {
+ return errors.Wrapf(err, "error executing template for default network")
+ }
+
+ // Next, we need to place the config on disk.
+ // Loop through possible indexes, with a limit of 100 attempts.
+ created := false
+ for i := 87; i < 187; i++ {
+ configFile, err := os.OpenFile(filepath.Join(configDir, fmt.Sprintf("%d-%s.conflist", i, name)), os.O_CREATE|os.O_EXCL|os.O_WRONLY, 0644)
+ if err != nil {
+ logrus.Infof("Attempt to create default CNI network config file failed: %v", err)
+ continue
+ }
+ defer configFile.Close()
+
+ created = true
+
+ // Success - file is open. Write our buffer to it.
+ if _, err := configFile.Write(output.Bytes()); err != nil {
+ return errors.Wrapf(err, "error writing default CNI config to file")
+ }
+ break
+ }
+ if !created {
+ return errors.Errorf("no available default network configuration file was found")
+ }
+
+ return nil
+}
+
+// Get the name of the configuration contained in a given conflist file. Accepts
+// the full path of a .conflist CNI configuration.
+func getConfigName(file string) (string, error) {
+ contents, err := ioutil.ReadFile(file)
+ if err != nil {
+ return "", err
+ }
+ config := new(network)
+ if err := json.Unmarshal(contents, config); err != nil {
+ return "", errors.Wrapf(err, "error decoding CNI configuration %s", filepath.Base(file))
+ }
+ return config.Name, nil
+}
diff --git a/vendor/github.com/containers/common/version/version.go b/vendor/github.com/containers/common/version/version.go
index f6f6d1608..54661f433 100644
--- a/vendor/github.com/containers/common/version/version.go
+++ b/vendor/github.com/containers/common/version/version.go
@@ -1,4 +1,4 @@
package version
// Version is the version of the build.
-const Version = "0.38.4"
+const Version = "0.39.0"
diff --git a/vendor/github.com/containers/storage/VERSION b/vendor/github.com/containers/storage/VERSION
index 3492b09b4..96cd6ee1e 100644
--- a/vendor/github.com/containers/storage/VERSION
+++ b/vendor/github.com/containers/storage/VERSION
@@ -1 +1 @@
-1.31.2
+1.32.1
diff --git a/vendor/github.com/containers/storage/containers.go b/vendor/github.com/containers/storage/containers.go
index 6407e9a83..b4f773f2b 100644
--- a/vendor/github.com/containers/storage/containers.go
+++ b/vendor/github.com/containers/storage/containers.go
@@ -626,5 +626,5 @@ func (r *containerStore) ReloadIfChanged() error {
if err == nil && modified {
return r.Load()
}
- return nil
+ return err
}
diff --git a/vendor/github.com/containers/storage/drivers/devmapper/deviceset.go b/vendor/github.com/containers/storage/drivers/devmapper/deviceset.go
index d9d19a0e1..19fb3fda9 100644
--- a/vendor/github.com/containers/storage/drivers/devmapper/deviceset.go
+++ b/vendor/github.com/containers/storage/drivers/devmapper/deviceset.go
@@ -2446,7 +2446,9 @@ func (devices *DeviceSet) UnmountDevice(hash, mountPath string) error {
logrus.Debugf("devmapper: Unmount(%s)", mountPath)
if err := mount.Unmount(mountPath); err != nil {
- return err
+ if ok, _ := Mounted(mountPath); ok {
+ return err
+ }
}
logrus.Debug("devmapper: Unmount done")
diff --git a/vendor/github.com/containers/storage/drivers/driver.go b/vendor/github.com/containers/storage/drivers/driver.go
index 1d2a65966..770b431bd 100644
--- a/vendor/github.com/containers/storage/drivers/driver.go
+++ b/vendor/github.com/containers/storage/drivers/driver.go
@@ -230,6 +230,9 @@ type AdditionalLayer interface {
// Info returns arbitrary information stored along with this layer (i.e. `info` file)
Info() (io.ReadCloser, error)
+ // Blob returns a reader of the raw contents of this layer.
+ Blob() (io.ReadCloser, error)
+
// Release tells the additional layer store that we don't use this handler.
Release()
}
@@ -243,6 +246,10 @@ type AdditionalLayerStoreDriver interface {
// LookupAdditionalLayer looks up additional layer store by the specified
// digest and ref and returns an object representing that layer.
LookupAdditionalLayer(d digest.Digest, ref string) (AdditionalLayer, error)
+
+ // LookupAdditionalLayer looks up additional layer store by the specified
+ // ID and returns an object representing that layer.
+ LookupAdditionalLayerByID(id string) (AdditionalLayer, error)
}
// DiffGetterDriver is the interface for layered file system drivers that
diff --git a/vendor/github.com/containers/storage/drivers/overlay/overlay.go b/vendor/github.com/containers/storage/drivers/overlay/overlay.go
index aed3899f8..d5d161bfd 100644
--- a/vendor/github.com/containers/storage/drivers/overlay/overlay.go
+++ b/vendor/github.com/containers/storage/drivers/overlay/overlay.go
@@ -721,6 +721,7 @@ func (d *Driver) Cleanup() error {
// LookupAdditionalLayer looks up additional layer store by the specified
// digest and ref and returns an object representing that layer.
// This API is experimental and can be changed without bumping the major version number.
+// TODO: to remove the comment once it's no longer experimental.
func (d *Driver) LookupAdditionalLayer(dgst digest.Digest, ref string) (graphdriver.AdditionalLayer, error) {
l, err := d.getAdditionalLayerPath(dgst, ref)
if err != nil {
@@ -736,6 +737,25 @@ func (d *Driver) LookupAdditionalLayer(dgst digest.Digest, ref string) (graphdri
}, nil
}
+// LookupAdditionalLayerByID looks up additional layer store by the specified
+// ID and returns an object representing that layer.
+// This API is experimental and can be changed without bumping the major version number.
+// TODO: to remove the comment once it's no longer experimental.
+func (d *Driver) LookupAdditionalLayerByID(id string) (graphdriver.AdditionalLayer, error) {
+ l, err := d.getAdditionalLayerPathByID(id)
+ if err != nil {
+ return nil, err
+ }
+ // Tell the additional layer store that we use this layer.
+ // This will increase reference counter on the store's side.
+ // This will be decreased on Release() method.
+ notifyUseAdditionalLayer(l)
+ return &additionalLayer{
+ path: l,
+ d: d,
+ }, nil
+}
+
// CreateFromTemplate creates a layer with the same contents and parent as another layer.
func (d *Driver) CreateFromTemplate(id, template string, templateIDMappings *idtools.IDMappings, parent string, parentIDMappings *idtools.IDMappings, opts *graphdriver.CreateOpts, readWrite bool) error {
if readWrite {
@@ -1655,7 +1675,7 @@ func (d *Driver) getLowerDiffPaths(id string) ([]string, error) {
// and its parent and returns the size in bytes of the changes
// relative to its base filesystem directory.
func (d *Driver) DiffSize(id string, idMappings *idtools.IDMappings, parent string, parentMappings *idtools.IDMappings, mountLabel string) (size int64, err error) {
- if d.useNaiveDiff() || !d.isParent(id, parent) {
+ if d.options.mountProgram == "" && (d.useNaiveDiff() || !d.isParent(id, parent)) {
return d.naiveDiff.DiffSize(id, idMappings, parent, parentMappings, mountLabel)
}
@@ -1833,9 +1853,7 @@ func (d *Driver) getAdditionalLayerPath(dgst digest.Digest, ref string) (string,
for _, p := range []string{
filepath.Join(target, "diff"),
filepath.Join(target, "info"),
- // TODO(ktock): We should have an API to expose the stream data of this layer
- // to enable the client to retrieve the entire contents of this
- // layer when it exports this layer.
+ filepath.Join(target, "blob"),
} {
if _, err := os.Stat(p); err != nil {
return "", errors.Wrapf(graphdriver.ErrLayerUnknown,
@@ -1850,8 +1868,8 @@ func (d *Driver) getAdditionalLayerPath(dgst digest.Digest, ref string) (string,
}
func (d *Driver) releaseAdditionalLayerByID(id string) {
- if al, err := ioutil.ReadFile(path.Join(d.dir(id), "additionallayer")); err == nil {
- notifyReleaseAdditionalLayer(string(al))
+ if al, err := d.getAdditionalLayerPathByID(id); err == nil {
+ notifyReleaseAdditionalLayer(al)
} else if !os.IsNotExist(err) {
logrus.Warnf("unexpected error on reading Additional Layer Store pointer %v", err)
}
@@ -1866,12 +1884,19 @@ type additionalLayer struct {
// Info returns arbitrary information stored along with this layer (i.e. `info` file).
// This API is experimental and can be changed without bumping the major version number.
+// TODO: to remove the comment once it's no longer experimental.
func (al *additionalLayer) Info() (io.ReadCloser, error) {
return os.Open(filepath.Join(al.path, "info"))
}
+// Blob returns a reader of the raw contents of this leyer.
+func (al *additionalLayer) Blob() (io.ReadCloser, error) {
+ return os.Open(filepath.Join(al.path, "blob"))
+}
+
// CreateAs creates a new layer from this additional layer.
// This API is experimental and can be changed without bumping the major version number.
+// TODO: to remove the comment once it's no longer experimental.
func (al *additionalLayer) CreateAs(id, parent string) error {
// TODO: support opts
if err := al.d.Create(id, parent, nil); err != nil {
@@ -1891,8 +1916,17 @@ func (al *additionalLayer) CreateAs(id, parent string) error {
return os.Symlink(filepath.Join(al.path, "diff"), diffDir)
}
+func (d *Driver) getAdditionalLayerPathByID(id string) (string, error) {
+ al, err := ioutil.ReadFile(path.Join(d.dir(id), "additionallayer"))
+ if err != nil {
+ return "", err
+ }
+ return string(al), nil
+}
+
// Release tells the additional layer store that we don't use this handler.
// This API is experimental and can be changed without bumping the major version number.
+// TODO: to remove the comment once it's no longer experimental.
func (al *additionalLayer) Release() {
// Tell the additional layer store that we don't use this layer handler.
// This will decrease the reference counter on the store's side, which was
diff --git a/vendor/github.com/containers/storage/go.mod b/vendor/github.com/containers/storage/go.mod
index 3d720cde2..e7ca56e64 100644
--- a/vendor/github.com/containers/storage/go.mod
+++ b/vendor/github.com/containers/storage/go.mod
@@ -10,7 +10,7 @@ require (
github.com/google/go-intervals v0.0.2
github.com/hashicorp/go-multierror v1.1.1
github.com/json-iterator/go v1.1.11
- github.com/klauspost/compress v1.12.2
+ github.com/klauspost/compress v1.12.3
github.com/klauspost/pgzip v1.2.5
github.com/mattn/go-shellwords v1.0.11
github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible
diff --git a/vendor/github.com/containers/storage/go.sum b/vendor/github.com/containers/storage/go.sum
index 91403a201..5373d0597 100644
--- a/vendor/github.com/containers/storage/go.sum
+++ b/vendor/github.com/containers/storage/go.sum
@@ -383,8 +383,8 @@ github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/compress v1.11.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/klauspost/compress v1.11.13/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
-github.com/klauspost/compress v1.12.2 h1:2KCfW3I9M7nSc5wOqXAlW2v2U6v+w6cbjvbfp+OykW8=
-github.com/klauspost/compress v1.12.2/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
+github.com/klauspost/compress v1.12.3 h1:G5AfA94pHPysR56qqrkO2pxEexdDzrpFJ6yt/VqWxVU=
+github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
github.com/klauspost/pgzip v1.2.5 h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE=
github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
diff --git a/vendor/github.com/containers/storage/images.go b/vendor/github.com/containers/storage/images.go
index c7b968e05..bca25a65b 100644
--- a/vendor/github.com/containers/storage/images.go
+++ b/vendor/github.com/containers/storage/images.go
@@ -810,5 +810,5 @@ func (r *imageStore) ReloadIfChanged() error {
if err == nil && modified {
return r.Load()
}
- return nil
+ return err
}
diff --git a/vendor/github.com/containers/storage/layers.go b/vendor/github.com/containers/storage/layers.go
index 394c00731..9b05474bb 100644
--- a/vendor/github.com/containers/storage/layers.go
+++ b/vendor/github.com/containers/storage/layers.go
@@ -1156,48 +1156,51 @@ func (r *layerStore) deleteInternal(id string) error {
}
id = layer.ID
err := r.driver.Remove(id)
- if err == nil {
- os.Remove(r.tspath(id))
- os.RemoveAll(r.datadir(id))
- delete(r.byid, id)
- for _, name := range layer.Names {
- delete(r.byname, name)
+ if err != nil {
+ return err
+ }
+
+ os.Remove(r.tspath(id))
+ os.RemoveAll(r.datadir(id))
+ delete(r.byid, id)
+ for _, name := range layer.Names {
+ delete(r.byname, name)
+ }
+ r.idindex.Delete(id)
+ mountLabel := layer.MountLabel
+ if layer.MountPoint != "" {
+ delete(r.bymount, layer.MountPoint)
+ }
+ r.deleteInDigestMap(id)
+ toDeleteIndex := -1
+ for i, candidate := range r.layers {
+ if candidate.ID == id {
+ toDeleteIndex = i
+ break
}
- r.idindex.Delete(id)
- mountLabel := layer.MountLabel
- if layer.MountPoint != "" {
- delete(r.bymount, layer.MountPoint)
+ }
+ if toDeleteIndex != -1 {
+ // delete the layer at toDeleteIndex
+ if toDeleteIndex == len(r.layers)-1 {
+ r.layers = r.layers[:len(r.layers)-1]
+ } else {
+ r.layers = append(r.layers[:toDeleteIndex], r.layers[toDeleteIndex+1:]...)
}
- r.deleteInDigestMap(id)
- toDeleteIndex := -1
- for i, candidate := range r.layers {
- if candidate.ID == id {
- toDeleteIndex = i
+ }
+ if mountLabel != "" {
+ var found bool
+ for _, candidate := range r.layers {
+ if candidate.MountLabel == mountLabel {
+ found = true
break
}
}
- if toDeleteIndex != -1 {
- // delete the layer at toDeleteIndex
- if toDeleteIndex == len(r.layers)-1 {
- r.layers = r.layers[:len(r.layers)-1]
- } else {
- r.layers = append(r.layers[:toDeleteIndex], r.layers[toDeleteIndex+1:]...)
- }
- }
- if mountLabel != "" {
- var found bool
- for _, candidate := range r.layers {
- if candidate.MountLabel == mountLabel {
- found = true
- break
- }
- }
- if !found {
- label.ReleaseLabel(mountLabel)
- }
+ if !found {
+ label.ReleaseLabel(mountLabel)
}
}
- return err
+
+ return nil
}
func (r *layerStore) deleteInDigestMap(id string) {
@@ -1401,6 +1404,52 @@ func (r *layerStore) Diff(from, to string, options *DiffOptions) (io.ReadCloser,
return maybeCompressReadCloser(diff)
}
+ if ad, ok := r.driver.(drivers.AdditionalLayerStoreDriver); ok {
+ if aLayer, err := ad.LookupAdditionalLayerByID(to); err == nil {
+ // This is an additional layer. We leverage blob API for aquiring the reproduced raw blob.
+ info, err := aLayer.Info()
+ if err != nil {
+ aLayer.Release()
+ return nil, err
+ }
+ defer info.Close()
+ layer := &Layer{}
+ if err := json.NewDecoder(info).Decode(layer); err != nil {
+ aLayer.Release()
+ return nil, err
+ }
+ blob, err := aLayer.Blob()
+ if err != nil {
+ aLayer.Release()
+ return nil, err
+ }
+ // If layer compression type is different from the expected one, decompress and convert it.
+ if compression != layer.CompressionType {
+ diff, err := archive.DecompressStream(blob)
+ if err != nil {
+ if err2 := blob.Close(); err2 != nil {
+ err = errors.Wrapf(err, "failed to close blob file: %v", err2)
+ }
+ aLayer.Release()
+ return nil, err
+ }
+ rc, err := maybeCompressReadCloser(diff)
+ if err != nil {
+ if err2 := closeAll(blob.Close, diff.Close); err2 != nil {
+ err = errors.Wrapf(err, "failed to cleanup: %v", err2)
+ }
+ aLayer.Release()
+ return nil, err
+ }
+ return ioutils.NewReadCloserWrapper(rc, func() error {
+ defer aLayer.Release()
+ return closeAll(blob.Close, rc.Close)
+ }), nil
+ }
+ return ioutils.NewReadCloserWrapper(blob, func() error { defer aLayer.Release(); return blob.Close() }), nil
+ }
+ }
+
tsfile, err := os.Open(r.tspath(to))
if err != nil {
if !os.IsNotExist(err) {
@@ -1731,5 +1780,18 @@ func (r *layerStore) ReloadIfChanged() error {
if err == nil && modified {
return r.Load()
}
- return nil
+ return err
+}
+
+func closeAll(closes ...func() error) (rErr error) {
+ for _, f := range closes {
+ if err := f(); err != nil {
+ if rErr == nil {
+ rErr = errors.Wrapf(err, "close error")
+ continue
+ }
+ rErr = errors.Wrapf(rErr, "%v", err)
+ }
+ }
+ return
}
diff --git a/vendor/github.com/containers/storage/store.go b/vendor/github.com/containers/storage/store.go
index 759407c63..d6d547c64 100644
--- a/vendor/github.com/containers/storage/store.go
+++ b/vendor/github.com/containers/storage/store.go
@@ -788,6 +788,15 @@ func (s *store) load() error {
}
s.containerStore = rcs
+ for _, store := range driver.AdditionalImageStores() {
+ gipath := filepath.Join(store, driverPrefix+"images")
+ ris, err := newROImageStore(gipath)
+ if err != nil {
+ return err
+ }
+ s.roImageStores = append(s.roImageStores, ris)
+ }
+
s.digestLockRoot = filepath.Join(s.runRoot, driverPrefix+"locks")
if err := os.MkdirAll(s.digestLockRoot, 0700); err != nil {
return err
@@ -910,22 +919,10 @@ func (s *store) ImageStore() (ImageStore, error) {
// Store. Accessing these stores directly will bypass locking and
// synchronization, so it is not a part of the exported Store interface.
func (s *store) ROImageStores() ([]ROImageStore, error) {
- if len(s.roImageStores) != 0 {
- return s.roImageStores, nil
- }
- driver, err := s.getGraphDriver()
- if err != nil {
- return nil, err
- }
- driverPrefix := s.graphDriverName + "-"
- for _, store := range driver.AdditionalImageStores() {
- gipath := filepath.Join(store, driverPrefix+"images")
- ris, err := newROImageStore(gipath)
- if err != nil {
- return nil, err
- }
- s.roImageStores = append(s.roImageStores, ris)
+ if s.imageStore == nil {
+ return nil, ErrLoadError
}
+
return s.roImageStores, nil
}
@@ -2655,8 +2652,13 @@ func (s *store) mount(id string, options drivers.MountOpts) (string, error) {
return "", err
}
+ modified, err := s.graphLock.Modified()
+ if err != nil {
+ return "", err
+ }
+
/* We need to make sure the home mount is present when the Mount is done. */
- if s.graphLock.TouchedSince(s.lastLoaded) {
+ if modified {
s.graphDriver = nil
s.layerStore = nil
s.graphDriver, err = s.getGraphDriver()
diff --git a/vendor/github.com/klauspost/compress/flate/deflate.go b/vendor/github.com/klauspost/compress/flate/deflate.go
index 40b5802de..5283ac5a5 100644
--- a/vendor/github.com/klauspost/compress/flate/deflate.go
+++ b/vendor/github.com/klauspost/compress/flate/deflate.go
@@ -644,7 +644,7 @@ func (d *compressor) init(w io.Writer, level int) (err error) {
d.fill = (*compressor).fillBlock
d.step = (*compressor).store
case level == ConstantCompression:
- d.w.logNewTablePenalty = 8
+ d.w.logNewTablePenalty = 10
d.window = make([]byte, 32<<10)
d.fill = (*compressor).fillBlock
d.step = (*compressor).storeHuff
diff --git a/vendor/github.com/klauspost/compress/flate/fast_encoder.go b/vendor/github.com/klauspost/compress/flate/fast_encoder.go
index 678f08105..347ac2c90 100644
--- a/vendor/github.com/klauspost/compress/flate/fast_encoder.go
+++ b/vendor/github.com/klauspost/compress/flate/fast_encoder.go
@@ -45,7 +45,7 @@ const (
bTableBits = 17 // Bits used in the big tables
bTableSize = 1 << bTableBits // Size of the table
- allocHistory = maxStoreBlockSize * 10 // Size to preallocate for history.
+ allocHistory = maxStoreBlockSize * 5 // Size to preallocate for history.
bufferReset = (1 << 31) - allocHistory - maxStoreBlockSize - 1 // Reset the buffer offset when reaching this.
)
diff --git a/vendor/github.com/klauspost/compress/flate/huffman_bit_writer.go b/vendor/github.com/klauspost/compress/flate/huffman_bit_writer.go
index db54be139..3ad5e9807 100644
--- a/vendor/github.com/klauspost/compress/flate/huffman_bit_writer.go
+++ b/vendor/github.com/klauspost/compress/flate/huffman_bit_writer.go
@@ -6,6 +6,7 @@ package flate
import (
"encoding/binary"
+ "fmt"
"io"
)
@@ -27,7 +28,7 @@ const (
// after which bytes are flushed to the writer.
// Should preferably be a multiple of 6, since
// we accumulate 6 bytes between writes to the buffer.
- bufferFlushSize = 240
+ bufferFlushSize = 246
// bufferSize is the actual output byte buffer size.
// It must have additional headroom for a flush
@@ -59,19 +60,31 @@ var offsetExtraBits = [64]int8{
14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20,
}
-var offsetBase = [64]uint32{
- /* normal deflate */
- 0x000000, 0x000001, 0x000002, 0x000003, 0x000004,
- 0x000006, 0x000008, 0x00000c, 0x000010, 0x000018,
- 0x000020, 0x000030, 0x000040, 0x000060, 0x000080,
- 0x0000c0, 0x000100, 0x000180, 0x000200, 0x000300,
- 0x000400, 0x000600, 0x000800, 0x000c00, 0x001000,
- 0x001800, 0x002000, 0x003000, 0x004000, 0x006000,
+var offsetCombined = [32]uint32{}
- /* extended window */
- 0x008000, 0x00c000, 0x010000, 0x018000, 0x020000,
- 0x030000, 0x040000, 0x060000, 0x080000, 0x0c0000,
- 0x100000, 0x180000, 0x200000, 0x300000,
+func init() {
+ var offsetBase = [64]uint32{
+ /* normal deflate */
+ 0x000000, 0x000001, 0x000002, 0x000003, 0x000004,
+ 0x000006, 0x000008, 0x00000c, 0x000010, 0x000018,
+ 0x000020, 0x000030, 0x000040, 0x000060, 0x000080,
+ 0x0000c0, 0x000100, 0x000180, 0x000200, 0x000300,
+ 0x000400, 0x000600, 0x000800, 0x000c00, 0x001000,
+ 0x001800, 0x002000, 0x003000, 0x004000, 0x006000,
+
+ /* extended window */
+ 0x008000, 0x00c000, 0x010000, 0x018000, 0x020000,
+ 0x030000, 0x040000, 0x060000, 0x080000, 0x0c0000,
+ 0x100000, 0x180000, 0x200000, 0x300000,
+ }
+
+ for i := range offsetCombined[:] {
+ // Don't use extended window values...
+ if offsetBase[i] > 0x006000 {
+ continue
+ }
+ offsetCombined[i] = uint32(offsetExtraBits[i])<<16 | (offsetBase[i])
+ }
}
// The odd order in which the codegen code sizes are written.
@@ -88,15 +101,16 @@ type huffmanBitWriter struct {
bits uint64
nbits uint16
nbytes uint8
+ lastHuffMan bool
literalEncoding *huffmanEncoder
+ tmpLitEncoding *huffmanEncoder
offsetEncoding *huffmanEncoder
codegenEncoding *huffmanEncoder
err error
lastHeader int
// Set between 0 (reused block can be up to 2x the size)
logNewTablePenalty uint
- lastHuffMan bool
- bytes [256]byte
+ bytes [256 + 8]byte
literalFreq [lengthCodesStart + 32]uint16
offsetFreq [32]uint16
codegenFreq [codegenCodeCount]uint16
@@ -128,6 +142,7 @@ func newHuffmanBitWriter(w io.Writer) *huffmanBitWriter {
return &huffmanBitWriter{
writer: w,
literalEncoding: newHuffmanEncoder(literalCount),
+ tmpLitEncoding: newHuffmanEncoder(literalCount),
codegenEncoding: newHuffmanEncoder(codegenCodeCount),
offsetEncoding: newHuffmanEncoder(offsetCodeCount),
}
@@ -745,9 +760,31 @@ func (w *huffmanBitWriter) writeTokens(tokens []token, leCodes, oeCodes []hcode)
offs := oeCodes[:32]
lengths := leCodes[lengthCodesStart:]
lengths = lengths[:32]
+
+ // Go 1.16 LOVES having these on stack.
+ bits, nbits, nbytes := w.bits, w.nbits, w.nbytes
+
for _, t := range tokens {
if t < matchType {
- w.writeCode(lits[t.literal()])
+ //w.writeCode(lits[t.literal()])
+ c := lits[t.literal()]
+ bits |= uint64(c.code) << nbits
+ nbits += c.len
+ if nbits >= 48 {
+ binary.LittleEndian.PutUint64(w.bytes[nbytes:], bits)
+ //*(*uint64)(unsafe.Pointer(&w.bytes[nbytes])) = bits
+ bits >>= 48
+ nbits -= 48
+ nbytes += 6
+ if nbytes >= bufferFlushSize {
+ if w.err != nil {
+ nbytes = 0
+ return
+ }
+ _, w.err = w.writer.Write(w.bytes[:nbytes])
+ nbytes = 0
+ }
+ }
continue
}
@@ -759,38 +796,99 @@ func (w *huffmanBitWriter) writeTokens(tokens []token, leCodes, oeCodes []hcode)
} else {
// inlined
c := lengths[lengthCode&31]
- w.bits |= uint64(c.code) << w.nbits
- w.nbits += c.len
- if w.nbits >= 48 {
- w.writeOutBits()
+ bits |= uint64(c.code) << nbits
+ nbits += c.len
+ if nbits >= 48 {
+ binary.LittleEndian.PutUint64(w.bytes[nbytes:], bits)
+ //*(*uint64)(unsafe.Pointer(&w.bytes[nbytes])) = bits
+ bits >>= 48
+ nbits -= 48
+ nbytes += 6
+ if nbytes >= bufferFlushSize {
+ if w.err != nil {
+ nbytes = 0
+ return
+ }
+ _, w.err = w.writer.Write(w.bytes[:nbytes])
+ nbytes = 0
+ }
}
}
extraLengthBits := uint16(lengthExtraBits[lengthCode&31])
if extraLengthBits > 0 {
+ //w.writeBits(extraLength, extraLengthBits)
extraLength := int32(length - lengthBase[lengthCode&31])
- w.writeBits(extraLength, extraLengthBits)
+ bits |= uint64(extraLength) << nbits
+ nbits += extraLengthBits
+ if nbits >= 48 {
+ binary.LittleEndian.PutUint64(w.bytes[nbytes:], bits)
+ //*(*uint64)(unsafe.Pointer(&w.bytes[nbytes])) = bits
+ bits >>= 48
+ nbits -= 48
+ nbytes += 6
+ if nbytes >= bufferFlushSize {
+ if w.err != nil {
+ nbytes = 0
+ return
+ }
+ _, w.err = w.writer.Write(w.bytes[:nbytes])
+ nbytes = 0
+ }
+ }
}
// Write the offset
offset := t.offset()
- offsetCode := offsetCode(offset)
+ offsetCode := offset >> 16
+ offset &= matchOffsetOnlyMask
if false {
w.writeCode(offs[offsetCode&31])
} else {
// inlined
- c := offs[offsetCode&31]
- w.bits |= uint64(c.code) << w.nbits
- w.nbits += c.len
- if w.nbits >= 48 {
- w.writeOutBits()
+ c := offs[offsetCode]
+ bits |= uint64(c.code) << nbits
+ nbits += c.len
+ if nbits >= 48 {
+ binary.LittleEndian.PutUint64(w.bytes[nbytes:], bits)
+ //*(*uint64)(unsafe.Pointer(&w.bytes[nbytes])) = bits
+ bits >>= 48
+ nbits -= 48
+ nbytes += 6
+ if nbytes >= bufferFlushSize {
+ if w.err != nil {
+ nbytes = 0
+ return
+ }
+ _, w.err = w.writer.Write(w.bytes[:nbytes])
+ nbytes = 0
+ }
}
}
- extraOffsetBits := uint16(offsetExtraBits[offsetCode&63])
- if extraOffsetBits > 0 {
- extraOffset := int32(offset - offsetBase[offsetCode&63])
- w.writeBits(extraOffset, extraOffsetBits)
+ offsetComb := offsetCombined[offsetCode]
+ if offsetComb > 1<<16 {
+ //w.writeBits(extraOffset, extraOffsetBits)
+ bits |= uint64(offset&matchOffsetOnlyMask-(offsetComb&0xffff)) << nbits
+ nbits += uint16(offsetComb >> 16)
+ if nbits >= 48 {
+ binary.LittleEndian.PutUint64(w.bytes[nbytes:], bits)
+ //*(*uint64)(unsafe.Pointer(&w.bytes[nbytes])) = bits
+ bits >>= 48
+ nbits -= 48
+ nbytes += 6
+ if nbytes >= bufferFlushSize {
+ if w.err != nil {
+ nbytes = 0
+ return
+ }
+ _, w.err = w.writer.Write(w.bytes[:nbytes])
+ nbytes = 0
+ }
+ }
}
}
+ // Restore...
+ w.bits, w.nbits, w.nbytes = bits, nbits, nbytes
+
if deferEOB {
w.writeCode(leCodes[endBlockMarker])
}
@@ -825,13 +923,28 @@ func (w *huffmanBitWriter) writeBlockHuff(eof bool, input []byte, sync bool) {
}
}
+ // Fill is rarely better...
+ const fill = false
+ const numLiterals = endBlockMarker + 1
+ const numOffsets = 1
+
// Add everything as literals
// We have to estimate the header size.
// Assume header is around 70 bytes:
// https://stackoverflow.com/a/25454430
const guessHeaderSizeBits = 70 * 8
- estBits := histogramSize(input, w.literalFreq[:], !eof && !sync)
- estBits += w.lastHeader + len(input)/32
+ histogram(input, w.literalFreq[:numLiterals], fill)
+ w.literalFreq[endBlockMarker] = 1
+ w.tmpLitEncoding.generate(w.literalFreq[:numLiterals], 15)
+ if fill {
+ // Clear fill...
+ for i := range w.literalFreq[:numLiterals] {
+ w.literalFreq[i] = 0
+ }
+ histogram(input, w.literalFreq[:numLiterals], false)
+ }
+ estBits := w.tmpLitEncoding.canReuseBits(w.literalFreq[:numLiterals])
+ estBits += w.lastHeader
if w.lastHeader == 0 {
estBits += guessHeaderSizeBits
}
@@ -839,33 +952,31 @@ func (w *huffmanBitWriter) writeBlockHuff(eof bool, input []byte, sync bool) {
// Store bytes, if we don't get a reasonable improvement.
ssize, storable := w.storedSize(input)
- if storable && ssize < estBits {
+ if storable && ssize <= estBits {
w.writeStoredHeader(len(input), eof)
w.writeBytes(input)
return
}
- reuseSize := 0
if w.lastHeader > 0 {
- reuseSize = w.literalEncoding.bitLength(w.literalFreq[:256])
+ reuseSize := w.literalEncoding.canReuseBits(w.literalFreq[:256])
if estBits < reuseSize {
+ if debugDeflate {
+ //fmt.Println("not reusing, reuse:", reuseSize/8, "> new:", estBits/8, "- header est:", w.lastHeader/8)
+ }
// We owe an EOB
w.writeCode(w.literalEncoding.codes[endBlockMarker])
w.lastHeader = 0
+ } else if debugDeflate {
+ fmt.Println("reusing, reuse:", reuseSize/8, "> new:", estBits/8, "- header est:", w.lastHeader/8)
}
}
- const numLiterals = endBlockMarker + 1
- const numOffsets = 1
+ count := 0
if w.lastHeader == 0 {
- if !eof && !sync {
- // Generate a slightly suboptimal tree that can be used for all.
- fillHist(w.literalFreq[:numLiterals])
- }
- w.literalFreq[endBlockMarker] = 1
- w.literalEncoding.generate(w.literalFreq[:numLiterals], 15)
-
+ // Use the temp encoding, so swap.
+ w.literalEncoding, w.tmpLitEncoding = w.tmpLitEncoding, w.literalEncoding
// Generate codegen and codegenFrequencies, which indicates how to encode
// the literalEncoding and the offsetEncoding.
w.generateCodegen(numLiterals, numOffsets, w.literalEncoding, huffOffset)
@@ -876,34 +987,47 @@ func (w *huffmanBitWriter) writeBlockHuff(eof bool, input []byte, sync bool) {
w.writeDynamicHeader(numLiterals, numOffsets, numCodegens, eof)
w.lastHuffMan = true
w.lastHeader, _ = w.headerSize()
+ if debugDeflate {
+ count += w.lastHeader
+ fmt.Println("header:", count/8)
+ }
}
- encoding := w.literalEncoding.codes[:257]
+ encoding := w.literalEncoding.codes[:256]
+ // Go 1.16 LOVES having these on stack. At least 1.5x the speed.
+ bits, nbits, nbytes := w.bits, w.nbits, w.nbytes
for _, t := range input {
// Bitwriting inlined, ~30% speedup
c := encoding[t]
- w.bits |= uint64(c.code) << w.nbits
- w.nbits += c.len
- if w.nbits >= 48 {
- bits := w.bits
- w.bits >>= 48
- w.nbits -= 48
- n := w.nbytes
- binary.LittleEndian.PutUint64(w.bytes[n:], bits)
- n += 6
- if n >= bufferFlushSize {
+ bits |= uint64(c.code) << nbits
+ nbits += c.len
+ if debugDeflate {
+ count += int(c.len)
+ }
+ if nbits >= 48 {
+ binary.LittleEndian.PutUint64(w.bytes[nbytes:], bits)
+ //*(*uint64)(unsafe.Pointer(&w.bytes[nbytes])) = bits
+ bits >>= 48
+ nbits -= 48
+ nbytes += 6
+ if nbytes >= bufferFlushSize {
if w.err != nil {
- n = 0
+ nbytes = 0
return
}
- w.write(w.bytes[:n])
- n = 0
+ _, w.err = w.writer.Write(w.bytes[:nbytes])
+ nbytes = 0
}
- w.nbytes = n
}
}
+ // Restore...
+ w.bits, w.nbits, w.nbytes = bits, nbits, nbytes
+
+ if debugDeflate {
+ fmt.Println("wrote", count/8, "bytes")
+ }
if eof || sync {
- w.writeCode(encoding[endBlockMarker])
+ w.writeCode(w.literalEncoding.codes[endBlockMarker])
w.lastHeader = 0
w.lastHuffMan = false
}
diff --git a/vendor/github.com/klauspost/compress/flate/huffman_code.go b/vendor/github.com/klauspost/compress/flate/huffman_code.go
index 0d3445a1c..67b2b3872 100644
--- a/vendor/github.com/klauspost/compress/flate/huffman_code.go
+++ b/vendor/github.com/klauspost/compress/flate/huffman_code.go
@@ -21,9 +21,13 @@ type hcode struct {
}
type huffmanEncoder struct {
- codes []hcode
- freqcache []literalNode
- bitCount [17]int32
+ codes []hcode
+ bitCount [17]int32
+
+ // Allocate a reusable buffer with the longest possible frequency table.
+ // Possible lengths are codegenCodeCount, offsetCodeCount and literalCount.
+ // The largest of these is literalCount, so we allocate for that case.
+ freqcache [literalCount + 1]literalNode
}
type literalNode struct {
@@ -132,6 +136,21 @@ func (h *huffmanEncoder) bitLengthRaw(b []byte) int {
return total
}
+// canReuseBits returns the number of bits or math.MaxInt32 if the encoder cannot be reused.
+func (h *huffmanEncoder) canReuseBits(freq []uint16) int {
+ var total int
+ for i, f := range freq {
+ if f != 0 {
+ code := h.codes[i]
+ if code.len == 0 {
+ return math.MaxInt32
+ }
+ total += int(f) * int(code.len)
+ }
+ }
+ return total
+}
+
// Return the number of literals assigned to each bit size in the Huffman encoding
//
// This method is only called when list.length >= 3
@@ -291,12 +310,6 @@ func (h *huffmanEncoder) assignEncodingAndSize(bitCount []int32, list []literalN
// freq An array of frequencies, in which frequency[i] gives the frequency of literal i.
// maxBits The maximum number of bits to use for any literal.
func (h *huffmanEncoder) generate(freq []uint16, maxBits int32) {
- if h.freqcache == nil {
- // Allocate a reusable buffer with the longest possible frequency table.
- // Possible lengths are codegenCodeCount, offsetCodeCount and literalCount.
- // The largest of these is literalCount, so we allocate for that case.
- h.freqcache = make([]literalNode, literalCount+1)
- }
list := h.freqcache[:len(freq)+1]
// Number of non-zero literals
count := 0
@@ -330,10 +343,14 @@ func (h *huffmanEncoder) generate(freq []uint16, maxBits int32) {
h.assignEncodingAndSize(bitCount, list)
}
+// atLeastOne clamps the result between 1 and 15.
func atLeastOne(v float32) float32 {
if v < 1 {
return 1
}
+ if v > 15 {
+ return 15
+ }
return v
}
@@ -346,31 +363,12 @@ func fillHist(b []uint16) {
}
}
-// histogramSize accumulates a histogram of b in h.
-// An estimated size in bits is returned.
-// len(h) must be >= 256, and h's elements must be all zeroes.
-func histogramSize(b []byte, h []uint16, fill bool) (bits int) {
+func histogram(b []byte, h []uint16, fill bool) {
h = h[:256]
for _, t := range b {
h[t]++
}
- total := len(b)
if fill {
- for _, v := range h {
- if v == 0 {
- total++
- }
- }
+ fillHist(h)
}
-
- invTotal := 1.0 / float32(total)
- shannon := float32(0.0)
- for _, v := range h {
- if v > 0 {
- n := float32(v)
- shannon += atLeastOne(-mFastLog2(n*invTotal)) * n
- }
- }
-
- return int(shannon + 0.99)
}
diff --git a/vendor/github.com/klauspost/compress/flate/token.go b/vendor/github.com/klauspost/compress/flate/token.go
index f9abf606d..eb862d7a9 100644
--- a/vendor/github.com/klauspost/compress/flate/token.go
+++ b/vendor/github.com/klauspost/compress/flate/token.go
@@ -13,14 +13,17 @@ import (
)
const (
+ // From top
// 2 bits: type 0 = literal 1=EOF 2=Match 3=Unused
// 8 bits: xlength = length - MIN_MATCH_LENGTH
- // 22 bits xoffset = offset - MIN_OFFSET_SIZE, or literal
- lengthShift = 22
- offsetMask = 1<<lengthShift - 1
- typeMask = 3 << 30
- literalType = 0 << 30
- matchType = 1 << 30
+ // 5 bits offsetcode
+ // 16 bits xoffset = offset - MIN_OFFSET_SIZE, or literal
+ lengthShift = 22
+ offsetMask = 1<<lengthShift - 1
+ typeMask = 3 << 30
+ literalType = 0 << 30
+ matchType = 1 << 30
+ matchOffsetOnlyMask = 0xffff
)
// The length code for length X (MIN_MATCH_LENGTH <= X <= MAX_MATCH_LENGTH)
@@ -187,7 +190,7 @@ func (t *tokens) indexTokens(in []token) {
t.AddLiteral(tok.literal())
continue
}
- t.AddMatch(uint32(tok.length()), tok.offset())
+ t.AddMatch(uint32(tok.length()), tok.offset()&matchOffsetOnlyMask)
}
}
@@ -232,7 +235,7 @@ func (t *tokens) EstimatedBits() int {
for _, v := range t.litHist[:] {
if v > 0 {
n := float32(v)
- shannon += -mFastLog2(n*invTotal) * n
+ shannon += atLeastOne(-mFastLog2(n*invTotal)) * n
}
}
// Just add 15 for EOB
@@ -240,7 +243,7 @@ func (t *tokens) EstimatedBits() int {
for i, v := range t.extraHist[1 : literalCount-256] {
if v > 0 {
n := float32(v)
- shannon += -mFastLog2(n*invTotal) * n
+ shannon += atLeastOne(-mFastLog2(n*invTotal)) * n
bits += int(lengthExtraBits[i&31]) * int(v)
nMatches += int(v)
}
@@ -251,7 +254,7 @@ func (t *tokens) EstimatedBits() int {
for i, v := range t.offHist[:offsetCodeCount] {
if v > 0 {
n := float32(v)
- shannon += -mFastLog2(n*invTotal) * n
+ shannon += atLeastOne(-mFastLog2(n*invTotal)) * n
bits += int(offsetExtraBits[i&31]) * int(v)
}
}
@@ -270,11 +273,13 @@ func (t *tokens) AddMatch(xlength uint32, xoffset uint32) {
panic(fmt.Errorf("invalid offset: %v", xoffset))
}
}
+ oCode := offsetCode(xoffset)
+ xoffset |= oCode << 16
t.nLits++
- lengthCode := lengthCodes1[uint8(xlength)] & 31
+
+ t.extraHist[lengthCodes1[uint8(xlength)]]++
+ t.offHist[oCode]++
t.tokens[t.n] = token(matchType | xlength<<lengthShift | xoffset)
- t.extraHist[lengthCode]++
- t.offHist[offsetCode(xoffset)&31]++
t.n++
}
@@ -286,7 +291,8 @@ func (t *tokens) AddMatchLong(xlength int32, xoffset uint32) {
panic(fmt.Errorf("invalid offset: %v", xoffset))
}
}
- oc := offsetCode(xoffset) & 31
+ oc := offsetCode(xoffset)
+ xoffset |= oc << 16
for xlength > 0 {
xl := xlength
if xl > 258 {
@@ -294,12 +300,11 @@ func (t *tokens) AddMatchLong(xlength int32, xoffset uint32) {
xl = 258 - baseMatchLength
}
xlength -= xl
- xl -= 3
+ xl -= baseMatchLength
t.nLits++
- lengthCode := lengthCodes1[uint8(xl)] & 31
- t.tokens[t.n] = token(matchType | uint32(xl)<<lengthShift | xoffset)
- t.extraHist[lengthCode]++
+ t.extraHist[lengthCodes1[uint8(xl)]]++
t.offHist[oc]++
+ t.tokens[t.n] = token(matchType | uint32(xl)<<lengthShift | xoffset)
t.n++
}
}
diff --git a/vendor/github.com/klauspost/compress/zstd/README.md b/vendor/github.com/klauspost/compress/zstd/README.md
index e7d7eb0ae..787813fa9 100644
--- a/vendor/github.com/klauspost/compress/zstd/README.md
+++ b/vendor/github.com/klauspost/compress/zstd/README.md
@@ -16,8 +16,7 @@ Currently the package is heavily optimized for 64 bit processors and will be sig
Install using `go get -u github.com/klauspost/compress`. The package is located in `github.com/klauspost/compress/zstd`.
-Godoc Documentation: https://godoc.org/github.com/klauspost/compress/zstd
-
+[![Go Reference](https://pkg.go.dev/badge/github.com/klauspost/compress/zstd.svg)](https://pkg.go.dev/github.com/klauspost/compress/zstd)
## Compressor
@@ -405,13 +404,28 @@ BenchmarkDecoder_DecodeAllParallelCgo/comp-data.bin.zst-16 749938
This reflects the performance around May 2020, but this may be out of date.
+## Zstd inside ZIP files
+
+It is possible to use zstandard to compress individual files inside zip archives.
+While this isn't widely supported it can be useful for internal files.
+
+To support the compression and decompression of these files you must register a compressor and decompressor.
+
+It is highly recommended registering the (de)compressors on individual zip Reader/Writer and NOT
+use the global registration functions. The main reason for this is that 2 registrations from
+different packages will result in a panic.
+
+It is a good idea to only have a single compressor and decompressor, since they can be used for multiple zip
+files concurrently, and using a single instance will allow reusing some resources.
+
+See [this example](https://pkg.go.dev/github.com/klauspost/compress/zstd#example-ZipCompressor) for
+how to compress and decompress files inside zip archives.
+
# Contributions
Contributions are always welcome.
For new features/fixes, remember to add tests and for performance enhancements include benchmarks.
-For sending files for reproducing errors use a service like [goobox](https://goobox.io/#/upload) or similar to share your files.
-
For general feedback and experience reports, feel free to open an issue or write me on [Twitter](https://twitter.com/sh0dan).
This package includes the excellent [`github.com/cespare/xxhash`](https://github.com/cespare/xxhash) package Copyright (c) 2016 Caleb Spare.
diff --git a/vendor/github.com/klauspost/compress/zstd/blockdec.go b/vendor/github.com/klauspost/compress/zstd/blockdec.go
index b51d922bd..6cea054d2 100644
--- a/vendor/github.com/klauspost/compress/zstd/blockdec.go
+++ b/vendor/github.com/klauspost/compress/zstd/blockdec.go
@@ -123,12 +123,10 @@ func newBlockDec(lowMem bool) *blockDec {
// Input must be a start of a block and will be at the end of the block when returned.
func (b *blockDec) reset(br byteBuffer, windowSize uint64) error {
b.WindowSize = windowSize
- tmp := br.readSmall(3)
- if tmp == nil {
- if debug {
- println("Reading block header:", io.ErrUnexpectedEOF)
- }
- return io.ErrUnexpectedEOF
+ tmp, err := br.readSmall(3)
+ if err != nil {
+ println("Reading block header:", err)
+ return err
}
bh := uint32(tmp[0]) | (uint32(tmp[1]) << 8) | (uint32(tmp[2]) << 16)
b.Last = bh&1 != 0
@@ -179,7 +177,6 @@ func (b *blockDec) reset(br byteBuffer, windowSize uint64) error {
if cap(b.dst) <= maxSize {
b.dst = make([]byte, 0, maxSize+1)
}
- var err error
b.data, err = br.readBig(cSize, b.dataStorage)
if err != nil {
if debug {
diff --git a/vendor/github.com/klauspost/compress/zstd/bytebuf.go b/vendor/github.com/klauspost/compress/zstd/bytebuf.go
index 658ef7838..17e820a6a 100644
--- a/vendor/github.com/klauspost/compress/zstd/bytebuf.go
+++ b/vendor/github.com/klauspost/compress/zstd/bytebuf.go
@@ -12,8 +12,8 @@ import (
type byteBuffer interface {
// Read up to 8 bytes.
- // Returns nil if no more input is available.
- readSmall(n int) []byte
+ // Returns io.ErrUnexpectedEOF if this cannot be satisfied.
+ readSmall(n int) ([]byte, error)
// Read >8 bytes.
// MAY use the destination slice.
@@ -29,17 +29,17 @@ type byteBuffer interface {
// in-memory buffer
type byteBuf []byte
-func (b *byteBuf) readSmall(n int) []byte {
+func (b *byteBuf) readSmall(n int) ([]byte, error) {
if debugAsserts && n > 8 {
panic(fmt.Errorf("small read > 8 (%d). use readBig", n))
}
bb := *b
if len(bb) < n {
- return nil
+ return nil, io.ErrUnexpectedEOF
}
r := bb[:n]
*b = bb[n:]
- return r
+ return r, nil
}
func (b *byteBuf) readBig(n int, dst []byte) ([]byte, error) {
@@ -81,19 +81,22 @@ type readerWrapper struct {
tmp [8]byte
}
-func (r *readerWrapper) readSmall(n int) []byte {
+func (r *readerWrapper) readSmall(n int) ([]byte, error) {
if debugAsserts && n > 8 {
panic(fmt.Errorf("small read > 8 (%d). use readBig", n))
}
n2, err := io.ReadFull(r.r, r.tmp[:n])
// We only really care about the actual bytes read.
- if n2 != n {
+ if err != nil {
+ if err == io.EOF {
+ return nil, io.ErrUnexpectedEOF
+ }
if debug {
println("readSmall: got", n2, "want", n, "err", err)
}
- return nil
+ return nil, err
}
- return r.tmp[:n]
+ return r.tmp[:n], nil
}
func (r *readerWrapper) readBig(n int, dst []byte) ([]byte, error) {
diff --git a/vendor/github.com/klauspost/compress/zstd/framedec.go b/vendor/github.com/klauspost/compress/zstd/framedec.go
index 693c5f05d..4dc151213 100644
--- a/vendor/github.com/klauspost/compress/zstd/framedec.go
+++ b/vendor/github.com/klauspost/compress/zstd/framedec.go
@@ -80,9 +80,14 @@ func (d *frameDec) reset(br byteBuffer) error {
d.WindowSize = 0
var b []byte
for {
- b = br.readSmall(4)
- if b == nil {
+ var err error
+ b, err = br.readSmall(4)
+ switch err {
+ case io.EOF, io.ErrUnexpectedEOF:
return io.EOF
+ default:
+ return err
+ case nil:
}
if !bytes.Equal(b[1:4], skippableFrameMagic) || b[0]&0xf0 != 0x50 {
if debug {
@@ -92,14 +97,14 @@ func (d *frameDec) reset(br byteBuffer) error {
break
}
// Read size to skip
- b = br.readSmall(4)
- if b == nil {
- println("Reading Frame Size EOF")
- return io.ErrUnexpectedEOF
+ b, err = br.readSmall(4)
+ if err != nil {
+ println("Reading Frame Size", err)
+ return err
}
n := uint32(b[0]) | (uint32(b[1]) << 8) | (uint32(b[2]) << 16) | (uint32(b[3]) << 24)
println("Skipping frame with", n, "bytes.")
- err := br.skipN(int(n))
+ err = br.skipN(int(n))
if err != nil {
if debug {
println("Reading discarded frame", err)
@@ -147,12 +152,11 @@ func (d *frameDec) reset(br byteBuffer) error {
if size == 3 {
size = 4
}
- b = br.readSmall(int(size))
- if b == nil {
- if debug {
- println("Reading Dictionary_ID", io.ErrUnexpectedEOF)
- }
- return io.ErrUnexpectedEOF
+
+ b, err = br.readSmall(int(size))
+ if err != nil {
+ println("Reading Dictionary_ID", err)
+ return err
}
var id uint32
switch size {
@@ -187,10 +191,10 @@ func (d *frameDec) reset(br byteBuffer) error {
}
d.FrameContentSize = 0
if fcsSize > 0 {
- b := br.readSmall(fcsSize)
- if b == nil {
- println("Reading Frame content", io.ErrUnexpectedEOF)
- return io.ErrUnexpectedEOF
+ b, err = br.readSmall(fcsSize)
+ if err != nil {
+ println("Reading Frame content", err)
+ return err
}
switch fcsSize {
case 1:
@@ -307,10 +311,10 @@ func (d *frameDec) checkCRC() error {
tmp[3] = byte(got >> 24)
// We can overwrite upper tmp now
- want := d.rawInput.readSmall(4)
- if want == nil {
- println("CRC missing?")
- return io.ErrUnexpectedEOF
+ want, err := d.rawInput.readSmall(4)
+ if err != nil {
+ println("CRC missing?", err)
+ return err
}
if !bytes.Equal(tmp[:], want) {
diff --git a/vendor/github.com/klauspost/compress/zstd/zip.go b/vendor/github.com/klauspost/compress/zstd/zip.go
index e35a0a2f8..9325b928a 100644
--- a/vendor/github.com/klauspost/compress/zstd/zip.go
+++ b/vendor/github.com/klauspost/compress/zstd/zip.go
@@ -13,8 +13,9 @@ import (
// See https://www.winzip.com/win/en/comp_info.html
const ZipMethodWinZip = 93
-// ZipMethodPKWare is the method number used by PKWARE to indicate Zstandard compression.
-// See https://pkware.cachefly.net/webdocs/APPNOTE/APPNOTE-6.3.7.TXT
+// ZipMethodPKWare is the original method number used by PKWARE to indicate Zstandard compression.
+// Deprecated: This has been deprecated by PKWARE, use ZipMethodWinZip instead for compression.
+// See https://pkware.cachefly.net/webdocs/APPNOTE/APPNOTE-6.3.9.TXT
const ZipMethodPKWare = 20
var zipReaderPool sync.Pool
diff --git a/vendor/github.com/onsi/gomega/CHANGELOG.md b/vendor/github.com/onsi/gomega/CHANGELOG.md
index b05f3a935..4783c0d43 100644
--- a/vendor/github.com/onsi/gomega/CHANGELOG.md
+++ b/vendor/github.com/onsi/gomega/CHANGELOG.md
@@ -1,3 +1,9 @@
+## 1.13.0
+
+### Features
+- gmeasure provides BETA support for benchmarking (#447) [8f2dfbf]
+- Set consistently and eventually defaults on init (#443) [12eb778]
+
## 1.12.0
### Features
diff --git a/vendor/github.com/onsi/gomega/env.go b/vendor/github.com/onsi/gomega/env.go
new file mode 100644
index 000000000..62fd885a9
--- /dev/null
+++ b/vendor/github.com/onsi/gomega/env.go
@@ -0,0 +1,40 @@
+package gomega
+
+import (
+ "os"
+
+ "github.com/onsi/gomega/internal/defaults"
+)
+
+const (
+ ConsistentlyDurationEnvVarName = "GOMEGA_DEFAULT_CONSISTENTLY_DURATION"
+ ConsistentlyPollingIntervalEnvVarName = "GOMEGA_DEFAULT_CONSISTENTLY_POLLING_INTERVAL"
+ EventuallyTimeoutEnvVarName = "GOMEGA_DEFAULT_EVENTUALLY_TIMEOUT"
+ EventuallyPollingIntervalEnvVarName = "GOMEGA_DEFAULT_EVENTUALLY_POLLING_INTERVAL"
+)
+
+func init() {
+ defaults.SetDurationFromEnv(
+ os.Getenv,
+ SetDefaultConsistentlyDuration,
+ ConsistentlyDurationEnvVarName,
+ )
+
+ defaults.SetDurationFromEnv(
+ os.Getenv,
+ SetDefaultConsistentlyPollingInterval,
+ ConsistentlyPollingIntervalEnvVarName,
+ )
+
+ defaults.SetDurationFromEnv(
+ os.Getenv,
+ SetDefaultEventuallyTimeout,
+ EventuallyTimeoutEnvVarName,
+ )
+
+ defaults.SetDurationFromEnv(
+ os.Getenv,
+ SetDefaultEventuallyPollingInterval,
+ EventuallyPollingIntervalEnvVarName,
+ )
+}
diff --git a/vendor/github.com/onsi/gomega/gomega_dsl.go b/vendor/github.com/onsi/gomega/gomega_dsl.go
index 9050e15e8..a05b34b27 100644
--- a/vendor/github.com/onsi/gomega/gomega_dsl.go
+++ b/vendor/github.com/onsi/gomega/gomega_dsl.go
@@ -24,7 +24,7 @@ import (
"github.com/onsi/gomega/types"
)
-const GOMEGA_VERSION = "1.12.0"
+const GOMEGA_VERSION = "1.13.0"
const nilFailHandlerPanic = `You are trying to make an assertion, but Gomega's fail handler is nil.
If you're using Ginkgo then you probably forgot to put your assertion in an It().
diff --git a/vendor/github.com/onsi/gomega/internal/defaults/env.go b/vendor/github.com/onsi/gomega/internal/defaults/env.go
new file mode 100644
index 000000000..bc29c63d5
--- /dev/null
+++ b/vendor/github.com/onsi/gomega/internal/defaults/env.go
@@ -0,0 +1,22 @@
+package defaults
+
+import (
+ "fmt"
+ "time"
+)
+
+func SetDurationFromEnv(getDurationFromEnv func(string) string, varSetter func(time.Duration), name string) {
+ durationFromEnv := getDurationFromEnv(name)
+
+ if len(durationFromEnv) == 0 {
+ return
+ }
+
+ duration, err := time.ParseDuration(durationFromEnv)
+
+ if err != nil {
+ panic(fmt.Sprintf("Expected a duration when using %s! Parse error %v", name, err))
+ }
+
+ varSetter(duration)
+}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index c5d79a9b7..879bb2759 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -91,7 +91,7 @@ github.com/containers/buildah/pkg/overlay
github.com/containers/buildah/pkg/parse
github.com/containers/buildah/pkg/rusage
github.com/containers/buildah/util
-# github.com/containers/common v0.38.4
+# github.com/containers/common v0.39.0
github.com/containers/common/libimage
github.com/containers/common/libimage/manifests
github.com/containers/common/pkg/apparmor
@@ -102,6 +102,7 @@ github.com/containers/common/pkg/cgroupv2
github.com/containers/common/pkg/chown
github.com/containers/common/pkg/completion
github.com/containers/common/pkg/config
+github.com/containers/common/pkg/defaultnet
github.com/containers/common/pkg/filters
github.com/containers/common/pkg/manifests
github.com/containers/common/pkg/parse
@@ -192,7 +193,7 @@ github.com/containers/psgo/internal/dev
github.com/containers/psgo/internal/host
github.com/containers/psgo/internal/proc
github.com/containers/psgo/internal/process
-# github.com/containers/storage v1.31.2
+# github.com/containers/storage v1.32.1
github.com/containers/storage
github.com/containers/storage/drivers
github.com/containers/storage/drivers/aufs
@@ -394,7 +395,7 @@ github.com/json-iterator/go
# github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a
github.com/juju/ansiterm
github.com/juju/ansiterm/tabwriter
-# github.com/klauspost/compress v1.12.2
+# github.com/klauspost/compress v1.12.3
github.com/klauspost/compress/flate
github.com/klauspost/compress/fse
github.com/klauspost/compress/huff0
@@ -475,13 +476,14 @@ github.com/onsi/ginkgo/reporters/stenographer
github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable
github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty
github.com/onsi/ginkgo/types
-# github.com/onsi/gomega v1.12.0
+# github.com/onsi/gomega v1.13.0
github.com/onsi/gomega
github.com/onsi/gomega/format
github.com/onsi/gomega/gbytes
github.com/onsi/gomega/gexec
github.com/onsi/gomega/internal/assertion
github.com/onsi/gomega/internal/asyncassertion
+github.com/onsi/gomega/internal/defaults
github.com/onsi/gomega/internal/oraclematcher
github.com/onsi/gomega/internal/testingtsupport
github.com/onsi/gomega/matchers