podman的用法
使用podman
检查正在运行的容器
我们甚至可以使用 inspect 子命令查看分配给容器的 IP 地址。由于容器以无根模式运行,因此未分配 IP 地址,并且该值将在检查的输出中列为“无”。
[root@localhost ~]# podman inspect -l |grep -i addr
"IPAddress": "10.88.0.2",
"GlobalIPv6Address": "",
"MacAddress": "26:d8:f7:9f:bb:a4",
"LinkLocalIPv6Address": "",
"IPAddress": "10.88.0.2",
"GlobalIPv6Address": "",
"MacAddress": "26:d8:f7:9f:bb:a4",
[root@localhost ~]# curl 10.88.0.2
<html><body><h1>It works!</h1></body></html>
[root@localhost ~]#
注意:-l 是最新容器的便利参数。您还可以使用容器的 ID 代替 -l。
查看一个运行中容器的日志
[root@localhost ~]# podman logs --latest
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 10.88.0.2. Set the 'ServerName' directive globally to suppress this message
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 10.88.0.2. Set the 'ServerName' directive globally to suppress this message
[Mon Aug 15 06:13:01.998854 2022] [mpm_event:notice] [pid 1:tid 140504491691328] AH00489: Apache/2.4.52 (Unix) configured -- resuming normal operations
[Mon Aug 15 06:13:02.004264 2022] [core:notice] [pid 1:tid 140504491691328] AH00094: Command line: 'httpd -D FOREGROUND'
10.88.0.1 - - [15/Aug/2022:06:14:34 +0000] "GET / HTTP/1.1" 200 45
[root@localhost ~]#
查看一个运行容器中的进程资源使用情况
[root@localhost ~]# podman ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
975e90c05c22 docker.io/library/httpd:latest httpd-foreground 5 minutes ago Up 5 minutes ago axi
[root@localhost ~]#