Debian13安装Podman

1、安装podman

apt install -y podman

2、安装podman-compose

apt install -y podman-compose

3、配置镜像加速器

vim /etc/containers/registries.conf

写入配置

unqualified-search-registries = ["docker.io"]
[[registry]]
prefix = "docker.io"
location = "cccc.xxx.com"
insecure = true

4、运行了Podman跑容器的电脑重启后,无法正常启动容器,原因是因为Podman不使用Daemon守护进程,所以podman run命令没有–restart=always参数来重启容器。

解决方案:

生成systemd文件

podman generate systemd --name nginx --files --new

将生成的文件移动到/etc/systemd/system

mv container-nginx.service /etc/systemd/system/

启动服务

systemctl daemon-reload
systemctl enable container-nginx.service
systemctl start container-nginx.service