mirror of https://github.com/containers/podman.git
fix: don't output "ago" when container is currently up and running
Closes #17250 Signed-off-by: Daniel Lublin <daniel@lublin.se>
This commit is contained in:
parent
8fce9dcde6
commit
497be102ad
|
@ -357,7 +357,7 @@ func (l psReporter) State() string {
|
||||||
switch l.ListContainer.State {
|
switch l.ListContainer.State {
|
||||||
case "running":
|
case "running":
|
||||||
t := units.HumanDuration(time.Since(time.Unix(l.StartedAt, 0)))
|
t := units.HumanDuration(time.Since(time.Unix(l.StartedAt, 0)))
|
||||||
state = "Up " + t + " ago"
|
state = "Up " + t
|
||||||
case "exited", "stopped":
|
case "exited", "stopped":
|
||||||
t := units.HumanDuration(time.Since(time.Unix(l.ExitedAt, 0)))
|
t := units.HumanDuration(time.Since(time.Unix(l.ExitedAt, 0)))
|
||||||
state = fmt.Sprintf("Exited (%d) %s ago", l.ExitCode, t)
|
state = fmt.Sprintf("Exited (%d) %s ago", l.ExitCode, t)
|
||||||
|
|
|
@ -137,7 +137,7 @@ $ systemctl --user start container-be0889fd06f252a2e5141b37072c6bada68563026cb2b
|
||||||
### Get the name of the container
|
### Get the name of the container
|
||||||
$ podman ps
|
$ podman ps
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
01f5c8113e84 docker.io/library/busybox:latest top 2 seconds ago Up 3 seconds ago inspiring_galileo
|
01f5c8113e84 docker.io/library/busybox:latest top 2 seconds ago Up 3 seconds inspiring_galileo
|
||||||
|
|
||||||
### Modify the image
|
### Modify the image
|
||||||
$ podman commit --change CMD=/bin/bash inspiring_galileo busybox:latest
|
$ podman commit --change CMD=/bin/bash inspiring_galileo busybox:latest
|
||||||
|
|
|
@ -302,7 +302,7 @@ bb310a0780ae docker.io/library/alpine:latest /bin/sh 2 minutes ago Created
|
||||||
$ sudo systemctl start container-busy_moser.service
|
$ sudo systemctl start container-busy_moser.service
|
||||||
$ sudo podman ps -a
|
$ sudo podman ps -a
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
772df2f8cf3b docker.io/library/alpine:latest /bin/sh 1 second ago Up 1 second ago distracted_albattani
|
772df2f8cf3b docker.io/library/alpine:latest /bin/sh 1 second ago Up 1 second distracted_albattani
|
||||||
bb310a0780ae docker.io/library/alpine:latest /bin/sh 3 minutes ago Created busy_moser
|
bb310a0780ae docker.io/library/alpine:latest /bin/sh 3 minutes ago Created busy_moser
|
||||||
```
|
```
|
||||||
## SEE ALSO
|
## SEE ALSO
|
||||||
|
|
|
@ -176,8 +176,8 @@ CONTAINER ID IMAGE COMMAND CREATED STATUS
|
||||||
```
|
```
|
||||||
$ podman ps
|
$ podman ps
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
4089df24d4f3 docker.io/library/centos:latest /bin/bash 2 minutes ago Up 2 minutes ago 0.0.0.0:80->8080/tcp, 0.0.0.0:2000-2006->2000-2006/tcp manyports
|
4089df24d4f3 docker.io/library/centos:latest /bin/bash 2 minutes ago Up 2 minutes 0.0.0.0:80->8080/tcp, 0.0.0.0:2000-2006->2000-2006/tcp manyports
|
||||||
92f58933c28c docker.io/library/centos:latest /bin/bash 3 minutes ago Up 3 minutes ago 192.168.99.100:1000-1006->1000-1006/tcp zen_sanderson
|
92f58933c28c docker.io/library/centos:latest /bin/bash 3 minutes ago Up 3 minutes 192.168.99.100:1000-1006->1000-1006/tcp zen_sanderson
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -280,8 +280,8 @@ var _ = Describe("Podman ps", func() {
|
||||||
// must contain "Status"
|
// must contain "Status"
|
||||||
match, StatusLine := result.GrepString(`Status`)
|
match, StatusLine := result.GrepString(`Status`)
|
||||||
Expect(match).To(BeTrue())
|
Expect(match).To(BeTrue())
|
||||||
// container is running or exit, so it must contain `ago`
|
// we waited for container to exit, so this must contain `Exited`
|
||||||
Expect(StatusLine[0]).To(ContainSubstring("ago"))
|
Expect(StatusLine[0]).To(ContainSubstring("Exited"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman ps namespace flag with go template format", func() {
|
It("podman ps namespace flag with go template format", func() {
|
||||||
|
|
Loading…
Reference in New Issue