centos8预装了podman,使用起来感觉跟docker差不多
podman官方文档:Getting Started with Podman
方法一:
sudo pip3 install podman-compose
如果运行报错,可用下面命令修复
sudo pip3 install --upgrade podman-compose
下载vulhub:
git clone https://github.com/vulhub/vulhub.git
去到对应目录:
[pop@localhost usr]$ cd /usr/vulhub/struts2/s2-001
podman-compose build #将镜像拉到本地 podman-compose up -d #启动容器
[pop@localhost s2-001]$ podman ps ConTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d051d5d5c13a registry.access.redhat.com/ubi8/pause:latest 9 seconds ago Up 8 seconds ago 0.0.0.0:8080->8080/tcp 3162692aa2b3-infra 2bd8589bbcc0 localhost/s2-001_struts2:latest catalina.sh run 8 seconds ago Up 7 seconds ago 0.0.0.0:8080->8080/tcp s2-001_struts2_1
可通过127.0.0.1:8080访问
关闭容器:
podman-compose down
方法二:
podman search vulhub podman pull docker.io/vulhub/struts2
会提示:
Trying to pull docker.io/vulhub/struts2:latest... Error: initializing source docker://vulhub/struts2:latest: reading manifest latest in docker.io/vulhub/struts2: manifest unknown: manifest unknown
没有latest这个tag,需要到Docker Hub里搜索对应的镜像
https://hub.docker.com/r/vulhub/struts2/tags
需要使用
podman pull vulhub/struts2:2.5.25
提示:
? Please select an image: registry.fedoraproject.org/vulhub/struts2:2.5.25 registry.access.redhat.com/vulhub/struts2:2.5.25 registry.centos.org/vulhub/struts2:2.5.25 ▸ docker.io/vulhub/struts2:2.5.25
选择最后一个
运行容器:
podman run -dt -p 8080:80/tcp docker.io/vulhub/struts2:2.5.25
[pop@localhost ~]$ podman ps ConTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES ef1b346b65ca docker.io/vulhub/struts2:2.5.25 mvn jetty:run 7 seconds ago Up 7 seconds ago 0.0.0.0:8080->80/tcp jovial_gauss
发现127.0.0.1:8080都无法打开,原因不明,等待好心人告知。。
如果是用那些有lastest tag的镜像,就可以访问



