使用Podman来运行nginx
这篇文章是在Windows10操作系统中启动Hyper-V,并在Hyper-V上安装RHEL8.4环境进行测试的结果。
提前安装Podman。
$ sudo dnf install podman
$ podman --version
podman version 3.2.3
启动nginx容器,确认镜像。检查容器列表。
$ podman run -d -p 8080:80 --name test_nginx nginx
$ podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/library/nginx latest dd34e67e3371 11 days ago 137 MB
$ podman ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1baef88e8fba docker.io/library/nginx:latest nginx -g daemon o... 26 minutes ago Up 26 minutes ago 0.0.0.0:8080->80/tcp test_nginx
使用curl进行运行确认。
$ curl http://localhost:8080
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>