Podman容器使用

系统版本  24.04.3 LTS

 

image

安装命令

sudo apt update

sudo dpkg --configure -a

sudo apt install podman

podman version

podman pull nginx :latest

podman pull nginx

# 1. 停止当前容器
podman stop nginx

# 2. 删除容器
podman rm nginx

# 3. 检查80端口是否被占用
sudo netstat -tulpn | grep :80

# 4. 重新创建容器,使用80端口映射

podman run -d -p 80:80 -p 8080:8080 --name nginx --restart=always -v /opt/nginx/conf.d:/etc/nginx/conf.d:Z -v /opt/nginx/html:/usr/share/nginx:Z nginx

# 5. 验证新端口映射
podman port nginx