文章

podman重启后容器无法自启动解决办法

运行了Podman跑容器的电脑重启后,无法正常启动容器,原因是因为Podman不使用Daemon守护进程,所以podman run命令没有–restart=always参数来重启容器。
解决方案:
生成systemd文件

podman generate systemd --name your-container-name --files --new

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

mv container-your-container-name.service /etc/systemd/system/

启动服务

systemctl daemon-reload
systemctl enable container-your-container-name.service
systemctl start container-your-container-name.service

License:  CC BY 4.0