summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/podman/system/version.go21
-rw-r--r--docs/source/markdown/podman-info.1.md294
-rw-r--r--docs/source/markdown/podman-version.1.md13
-rw-r--r--libpod/define/version.go27
-rw-r--r--pkg/bindings/system/system.go12
-rw-r--r--pkg/domain/infra/tunnel/containers.go23
-rw-r--r--pkg/varlinkapi/system.go2
-rw-r--r--test/e2e/images_test.go1
-rw-r--r--test/e2e/pause_test.go1
-rw-r--r--test/e2e/rm_test.go1
-rw-r--r--test/e2e/stop_test.go1
-rw-r--r--test/system/001-basic.bats2
-rw-r--r--version/version.go4
13 files changed, 254 insertions, 148 deletions
diff --git a/cmd/podman/system/version.go b/cmd/podman/system/version.go
index 50bd81368..92a3225b6 100644
--- a/cmd/podman/system/version.go
+++ b/cmd/podman/system/version.go
@@ -6,8 +6,8 @@ import (
"os"
"strings"
"text/tabwriter"
- "time"
+ "github.com/containers/buildah/pkg/formats"
"github.com/containers/libpod/cmd/podman/registry"
"github.com/containers/libpod/cmd/podman/validate"
"github.com/containers/libpod/libpod/define"
@@ -52,6 +52,17 @@ func version(cmd *cobra.Command, args []string) error {
if !strings.HasSuffix(versionFormat, "\n") {
versionFormat += "\n"
}
+ out := formats.StdoutTemplate{Output: versions, Template: versionFormat}
+ err := out.Out()
+ if err != nil {
+ // On Failure, assume user is using older version of podman version --format and check client
+ versionFormat = strings.Replace(versionFormat, ".Server.", ".", 1)
+ out = formats.StdoutTemplate{Output: versions.Client, Template: versionFormat}
+ if err1 := out.Out(); err1 != nil {
+ return err
+ }
+ }
+ return nil
}
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
@@ -74,15 +85,11 @@ func version(cmd *cobra.Command, args []string) error {
func formatVersion(writer io.Writer, version *define.Version) {
fmt.Fprintf(writer, "Version:\t%s\n", version.Version)
- fmt.Fprintf(writer, "RemoteAPI Version:\t%d\n", version.RemoteAPIVersion)
+ fmt.Fprintf(writer, "API Version:\t%d\n", version.APIVersion)
fmt.Fprintf(writer, "Go Version:\t%s\n", version.GoVersion)
if version.GitCommit != "" {
fmt.Fprintf(writer, "Git Commit:\t%s\n", version.GitCommit)
}
- // Prints out the build time in readable format
- if version.Built != 0 {
- fmt.Fprintf(writer, "Built:\t%s\n", time.Unix(version.Built, 0).Format(time.ANSIC))
- }
-
+ fmt.Fprintf(writer, "Built:\t%s\n", version.BuiltTime)
fmt.Fprintf(writer, "OS/Arch:\t%s\n", version.OsArch)
}
diff --git a/docs/source/markdown/podman-info.1.md b/docs/source/markdown/podman-info.1.md
index d9da4c3f8..24ab97c91 100644
--- a/docs/source/markdown/podman-info.1.md
+++ b/docs/source/markdown/podman-info.1.md
@@ -30,128 +30,212 @@ Run podman info with plain text response:
```
$ podman info
host:
- BuildahVersion: 1.4-dev
- Conmon:
- package: Unknown
- path: /usr/libexec/podman/conmon
- version: 'conmon version 1.12.0-dev, commit: d724f3d54ad2d95b6de741085d4990190ebfd7ff'
- Distribution:
- distribution: fedora
- version: "28"
- MemFree: 1271083008
- MemTotal: 33074233344
- OCIRuntime:
- package: runc-1.0.0-51.dev.gitfdd8055.fc28.x86_64
- path: /usr/bin/runc
- version: 'runc version spec: 1.0.0'
- SwapFree: 34309664768
- SwapTotal: 34359734272
arch: amd64
+ buildahVersion: 1.15.0
+ cgroupVersion: v1
+ conmon:
+ package: conmon-2.0.16-2.fc32.x86_64
+ path: /usr/bin/conmon
+ version: 'conmon version 2.0.16, commit: 1044176f7dd177c100779d1c63931d6022e419bd'
cpus: 8
+ distribution:
+ distribution: fedora
+ version: "32"
+ eventLogger: file
hostname: localhost.localdomain
- kernel: 4.18.7-200.fc28.x86_64
+ idMappings:
+ gidmap:
+ - container_id: 0
+ host_id: 3267
+ size: 1
+ - container_id: 1
+ host_id: 100000
+ size: 65536
+ uidmap:
+ - container_id: 0
+ host_id: 3267
+ size: 1
+ - container_id: 1
+ host_id: 100000
+ size: 65536
+ kernel: 5.6.11-300.fc32.x86_64
+ linkmode: dynamic
+ memFree: 1401929728
+ memTotal: 16416161792
+ ociRuntime:
+ name: runc
+ package: containerd.io-1.2.10-3.2.fc31.x86_64
+ path: /usr/bin/runc
+ version: |-
+ runc version 1.0.0-rc8+dev
+ commit: 3e425f80a8c931f88e6d94a8c831b9d5aa481657
+ spec: 1.0.1-dev
os: linux
- uptime: 218h 49m 33.66s (Approximately 9.08 days)
+ rootless: true
+ slirp4netns:
+ executable: /bin/slirp4netns
+ package: slirp4netns-1.0.0-1.fc32.x86_64
+ version: |-
+ slirp4netns version 1.0.0
+ commit: a3be729152a33e692cd28b52f664defbf2e7810a
+ libslirp: 4.2.0
+ swapFree: 8291610624
+ swapTotal: 8296329216
+ uptime: 52h 29m 39.78s (Approximately 2.17 days)
registries:
- docker.io:
- Blocked: true
- Insecure: true
- Location: docker.io
- MirrorByDigestOnly: false
- Mirrors:
- - Insecure: true
- Location: example2.io/example/ubi8-minimal
- Prefix: docker.io
- redhat.com:
- Blocked: false
- Insecure: false
- Location: registry.access.redhat.com/ubi8
- MirrorByDigestOnly: true
- Mirrors:
- - Insecure: false
- Location: example.io/example/ubi8-minimal
- - Insecure: true
- Location: example3.io/example/ubi8-minimal
- Prefix: redhat.com
+ search:
+ - registry.fedoraproject.org
+ - registry.access.redhat.com
+ - registry.centos.org
+ - docker.io
store:
- ConfigFile: /etc/containers/storage.conf
- ContainerStore:
- number: 37
- GraphDriverName: overlay
- GraphOptions:
- - overlay.mountopt=nodev
- - overlay.override_kernel_check=true
- GraphRoot: /var/lib/containers/storage
- GraphStatus:
+ configFile: /home/dwalsh/.config/containers/storage.conf
+ containerStore:
+ number: 2
+ paused: 0
+ running: 0
+ stopped: 2
+ graphDriverName: overlay
+ graphOptions:
+ overlay.mount_program:
+ Executable: /home/dwalsh/bin/fuse-overlayfs
+ Package: Unknown
+ Version: |-
+ fusermount3 version: 3.9.1
+ fuse-overlayfs: version 0.7.2
+ FUSE library version 3.9.1
+ using FUSE kernel interface version 7.31
+ graphRoot: /home/dwalsh/.local/share/containers/storage
+ graphStatus:
Backing Filesystem: extfs
- Native Overlay Diff: "true"
+ Native Overlay Diff: "false"
Supports d_type: "true"
- ImageStore:
- number: 17
- RunRoot: /var/run/containers/storage
-
+ Using metacopy: "false"
+ imageStore:
+ number: 7
+ runRoot: /run/user/3267/containers
+ volumePath: /home/dwalsh/.local/share/containers/storage/volumes
+version:
+ Built: 1589899246
+ BuiltTime: Tue May 19 10:40:46 2020
+ GitCommit: c3678ce3289f4195f3f16802411e795c6a587c9f-dirty
+ GoVersion: go1.14.2
+ OsArch: linux/amd64
+ APIVersion: 1
+ Version: 2.0.0
```
Run podman info with JSON formatted response:
```
{
- "host": {
- "BuildahVersion": "1.4-dev",
- "Conmon": {
- "package": "Unknown",
- "path": "/usr/libexec/podman/conmon",
- "version": "conmon version 1.12.0-dev, commit: d724f3d54ad2d95b6de741085d4990190ebfd7ff"
- },
- "Distribution": {
- "distribution": "fedora",
- "version": "28"
+ "host": {
+ "arch": "amd64",
+ "buildahVersion": "1.15.0",
+ "cgroupVersion": "v1",
+ "conmon": {
+ "package": "conmon-2.0.16-2.fc32.x86_64",
+ "path": "/usr/bin/conmon",
+ "version": "conmon version 2.0.16, commit: 1044176f7dd177c100779d1c63931d6022e419bd"
+ },
+ "cpus": 8,
+ "distribution": {
+ "distribution": "fedora",
+ "version": "32"
+ },
+ "eventLogger": "file",
+ "hostname": "localhost.localdomain",
+ "idMappings": {
+ "gidmap": [
+ {
+ "container_id": 0,
+ "host_id": 3267,
+ "size": 1
},
- "MemFree": 1204109312,
- "MemTotal": 33074233344,
- "OCIRuntime": {
- "package": "runc-1.0.0-51.dev.gitfdd8055.fc28.x86_64",
- "path": "/usr/bin/runc",
- "version": "runc version spec: 1.0.0"
+ {
+ "container_id": 1,
+ "host_id": 100000,
+ "size": 65536
+ }
+ ],
+ "uidmap": [
+ {
+ "container_id": 0,
+ "host_id": 3267,
+ "size": 1
},
- "SwapFree": 34309664768,
- "SwapTotal": 34359734272,
- "arch": "amd64",
- "cpus": 8,
- "hostname": "localhost.localdomain",
- "kernel": "4.18.7-200.fc28.x86_64",
- "os": "linux",
- "uptime": "218h 50m 35.02s (Approximately 9.08 days)"
+ {
+ "container_id": 1,
+ "host_id": 100000,
+ "size": 65536
+ }
+ ]
},
- "insecure registries": {
- "registries": []
+ "kernel": "5.6.11-300.fc32.x86_64",
+ "memFree": 1380356096,
+ "memTotal": 16416161792,
+ "ociRuntime": {
+ "name": "runc",
+ "package": "containerd.io-1.2.10-3.2.fc31.x86_64",
+ "path": "/usr/bin/runc",
+ "version": "runc version 1.0.0-rc8+dev\ncommit: 3e425f80a8c931f88e6d94a8c831b9d5aa481657\nspec: 1.0.1-dev"
},
- "registries": {
- "registries": [
- "quay.io",
- "registry.fedoraproject.org",
- "docker.io",
- "registry.access.redhat.com"
- ]
+ "os": "linux",
+ "rootless": true,
+ "slirp4netns": {
+ "executable": "/bin/slirp4netns",
+ "package": "slirp4netns-1.0.0-1.fc32.x86_64",
+ "version": "slirp4netns version 1.0.0\ncommit: a3be729152a33e692cd28b52f664defbf2e7810a\nlibslirp: 4.2.0"
},
- "store": {
- "ContainerStore": {
- "number": 37
- },
- "GraphDriverName": "overlay",
- "GraphOptions": [
- "overlay.mountopt=nodev",
- "overlay.override_kernel_check=true"
- ],
- "GraphRoot": "/var/lib/containers/storage",
- "GraphStatus": {
- "Backing Filesystem": "extfs",
- "Native Overlay Diff": "true",
- "Supports d_type": "true"
- },
- "ImageStore": {
- "number": 17
- },
- "RunRoot": "/var/run/containers/storage"
- }
+ "swapFree": 8291610624,
+ "swapTotal": 8296329216,
+ "uptime": "52h 27m 39.38s (Approximately 2.17 days)",
+ "linkmode": "dynamic"
+ },
+ "store": {
+ "configFile": "/home/dwalsh/.config/containers/storage.conf",
+ "containerStore": {
+ "number": 2,
+ "paused": 0,
+ "running": 0,
+ "stopped": 2
+ },
+ "graphDriverName": "overlay",
+ "graphOptions": {
+ "overlay.mount_program": {
+ "Executable": "/home/dwalsh/bin/fuse-overlayfs",
+ "Package": "Unknown",
+ "Version": "fusermount3 version: 3.9.1\nfuse-overlayfs: version 0.7.2\nFUSE library version 3.9.1\nusing FUSE kernel interface version 7.31"
+}
+ },
+ "graphRoot": "/home/dwalsh/.local/share/containers/storage",
+ "graphStatus": {
+ "Backing Filesystem": "extfs",
+ "Native Overlay Diff": "false",
+ "Supports d_type": "true",
+ "Using metacopy": "false"
+ },
+ "imageStore": {
+ "number": 7
+ },
+ "runRoot": "/run/user/3267/containers",
+ "volumePath": "/home/dwalsh/.local/share/containers/storage/volumes"
+ },
+ "registries": {
+ "search": [
+ "registry.fedoraproject.org",
+ "registry.access.redhat.com",
+ "registry.centos.org",
+ "docker.io"
+]
+ },
+ "version": {
+ "APIVersion": 1,
+ "Version": "2.0.0",
+ "GoVersion": "go1.14.2",
+ "GitCommit": "c3678ce3289f4195f3f16802411e795c6a587c9f-dirty",
+ "BuiltTime": "Tue May 19 10:40:46 2020",
+ "Built": 1589899246,
+ "OsArch": "linux/amd64"
+ }
}
```
Run podman info and only get the registries information.
diff --git a/docs/source/markdown/podman-version.1.md b/docs/source/markdown/podman-version.1.md
index 86c270e02..185e8e296 100644
--- a/docs/source/markdown/podman-version.1.md
+++ b/docs/source/markdown/podman-version.1.md
@@ -25,17 +25,18 @@ Change output format to "json" or a Go template.
A sample output of the `version` command:
```
$ podman version
-Version: 0.11.1
-Go Version: go1.11
-Git Commit: "8967a1d691ed44896b81ad48c863033f23c65eb0-dirty"
-Built: Thu Nov 8 22:35:40 2018
-OS/Arch: linux/amd64
+Version: 2.0.0
+API Version: 1
+Go Version: go1.14.2
+Git Commit: 4520664f63c3a7f9a80227715359e20069d95542
+Built: Tue May 19 10:48:59 2020
+OS/Arch: linux/amd64
```
Filtering out only the version:
```
$ podman version --format '{{.Client.Version}}'
-1.6.3
+2.0.0
```
## SEE ALSO
diff --git a/libpod/define/version.go b/libpod/define/version.go
index 954cd00f1..3eb016264 100644
--- a/libpod/define/version.go
+++ b/libpod/define/version.go
@@ -3,6 +3,7 @@ package define
import (
"runtime"
"strconv"
+ "time"
podmanVersion "github.com/containers/libpod/version"
)
@@ -19,12 +20,13 @@ var (
// Version is an output struct for varlink
type Version struct {
- RemoteAPIVersion int64
- Version string
- GoVersion string
- GitCommit string
- Built int64
- OsArch string
+ APIVersion int64
+ Version string
+ GoVersion string
+ GitCommit string
+ BuiltTime string
+ Built int64
+ OsArch string
}
// GetVersion returns a VersionOutput struct for varlink and podman
@@ -40,11 +42,12 @@ func GetVersion() (Version, error) {
}
}
return Version{
- RemoteAPIVersion: podmanVersion.RemoteAPIVersion,
- Version: podmanVersion.Version,
- GoVersion: runtime.Version(),
- GitCommit: gitCommit,
- Built: buildTime,
- OsArch: runtime.GOOS + "/" + runtime.GOARCH,
+ APIVersion: podmanVersion.APIVersion,
+ Version: podmanVersion.Version,
+ GoVersion: runtime.Version(),
+ GitCommit: gitCommit,
+ BuiltTime: time.Unix(buildTime, 0).Format(time.ANSIC),
+ Built: buildTime,
+ OsArch: runtime.GOOS + "/" + runtime.GOARCH,
}, nil
}
diff --git a/pkg/bindings/system/system.go b/pkg/bindings/system/system.go
index e567e7a86..ed960b8e0 100644
--- a/pkg/bindings/system/system.go
+++ b/pkg/bindings/system/system.go
@@ -112,12 +112,12 @@ func Version(ctx context.Context) (*entities.SystemVersionReport, error) {
f, _ := strconv.ParseFloat(component.APIVersion, 64)
b, _ := time.Parse(time.RFC3339, component.BuildTime)
report.Server = &define.Version{
- RemoteAPIVersion: int64(f),
- Version: component.Version.Version,
- GoVersion: component.GoVersion,
- GitCommit: component.GitCommit,
- Built: b.Unix(),
- OsArch: fmt.Sprintf("%s/%s", component.Os, component.Arch),
+ APIVersion: int64(f),
+ Version: component.Version.Version,
+ GoVersion: component.GoVersion,
+ GitCommit: component.GitCommit,
+ Built: b.Unix(),
+ OsArch: fmt.Sprintf("%s/%s", component.Os, component.Arch),
}
return &report, err
}
diff --git a/pkg/domain/infra/tunnel/containers.go b/pkg/domain/infra/tunnel/containers.go
index a031b740e..30c4a8359 100644
--- a/pkg/domain/infra/tunnel/containers.go
+++ b/pkg/domain/infra/tunnel/containers.go
@@ -87,10 +87,25 @@ func (ic *ContainerEngine) ContainerStop(ctx context.Context, namesOrIds []strin
}
for _, c := range ctrs {
report := entities.StopReport{Id: c.ID}
- report.Err = containers.Stop(ic.ClientCxt, c.ID, &options.Timeout)
- // TODO we need to associate errors returned by http with common
- // define.errors so that we can equity tests. this will allow output
- // to be the same as the native client
+ if err = containers.Stop(ic.ClientCxt, c.ID, &options.Timeout); err != nil {
+ // These first two are considered non-fatal under the right conditions
+ if errors.Cause(err).Error() == define.ErrCtrStopped.Error() {
+ logrus.Debugf("Container %s is already stopped", c.ID)
+ reports = append(reports, &report)
+ continue
+ } else if options.All && errors.Cause(err).Error() == define.ErrCtrStateInvalid.Error() {
+ logrus.Debugf("Container %s is not running, could not stop", c.ID)
+ reports = append(reports, &report)
+ continue
+ }
+
+ // TODO we need to associate errors returned by http with common
+ // define.errors so that we can equity tests. this will allow output
+ // to be the same as the native client
+ report.Err = err
+ reports = append(reports, &report)
+ continue
+ }
reports = append(reports, &report)
}
return reports, nil
diff --git a/pkg/varlinkapi/system.go b/pkg/varlinkapi/system.go
index 82efe9b5d..308f02274 100644
--- a/pkg/varlinkapi/system.go
+++ b/pkg/varlinkapi/system.go
@@ -28,7 +28,7 @@ func (i *VarlinkAPI) GetVersion(call iopodman.VarlinkCall) error {
versionInfo.GitCommit,
time.Unix(versionInfo.Built, 0).Format(time.RFC3339),
versionInfo.OsArch,
- versionInfo.RemoteAPIVersion,
+ versionInfo.APIVersion,
)
}
diff --git a/test/e2e/images_test.go b/test/e2e/images_test.go
index 1715cf8c1..1b23aba36 100644
--- a/test/e2e/images_test.go
+++ b/test/e2e/images_test.go
@@ -131,7 +131,6 @@ var _ = Describe("Podman images", func() {
})
It("podman images filter by image name", func() {
- Skip(v2remotefail)
podmanTest.RestoreAllArtifacts()
session := podmanTest.PodmanNoCache([]string{"images", "-q", ALPINE})
session.WaitWithDefaultTimeout()
diff --git a/test/e2e/pause_test.go b/test/e2e/pause_test.go
index 2faa4bc3f..149a2e28a 100644
--- a/test/e2e/pause_test.go
+++ b/test/e2e/pause_test.go
@@ -297,7 +297,6 @@ var _ = Describe("Podman pause", func() {
})
It("Unpause a bunch of running containers", func() {
- Skip(v2remotefail)
for i := 0; i < 3; i++ {
name := fmt.Sprintf("test%d", i)
run := podmanTest.Podman([]string{"run", "-dt", "--name", name, nginx})
diff --git a/test/e2e/rm_test.go b/test/e2e/rm_test.go
index 552683d8c..87e3de922 100644
--- a/test/e2e/rm_test.go
+++ b/test/e2e/rm_test.go
@@ -43,7 +43,6 @@ var _ = Describe("Podman rm", func() {
})
It("podman rm refuse to remove a running container", func() {
- Skip(v2remotefail)
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
diff --git a/test/e2e/stop_test.go b/test/e2e/stop_test.go
index 8e49e3bd0..cd78a54e1 100644
--- a/test/e2e/stop_test.go
+++ b/test/e2e/stop_test.go
@@ -217,7 +217,6 @@ var _ = Describe("Podman stop", func() {
})
It("podman stop all containers with one created", func() {
- Skip(v2remotefail)
session := podmanTest.RunTopContainer("test1")
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
diff --git a/test/system/001-basic.bats b/test/system/001-basic.bats
index 5fc07acfb..71595f419 100644
--- a/test/system/001-basic.bats
+++ b/test/system/001-basic.bats
@@ -23,7 +23,7 @@ function setup() {
is "${lines[0]}" "Version:[ ]\+[1-9][0-9.]\+" "Version line 1"
is "$output" ".*Go Version: \+" "'Go Version' in output"
- is "$output" ".*RemoteAPI Version: \+" "API version in output"
+ is "$output" ".*API Version: \+" "API version in output"
}
diff --git a/version/version.go b/version/version.go
index fe602d8e1..4c7202e77 100644
--- a/version/version.go
+++ b/version/version.go
@@ -6,7 +6,7 @@ package version
// bumped.
const Version = "2.0.0-dev"
-// RemoteAPIVersion is the version for the remote
+// APIVersion is the version for the remote
// client API. It is used to determine compatibility
// between a remote podman client and its backend
-const RemoteAPIVersion = 1
+const APIVersion = 1