Tag Archives: 拉起容器

使用podman后实现容器开机自启

之前Docker时有个--restart always的参数,能实现开机自启(原意是挂掉后拉起)

在切换到podman后无效了,原因是podman设计的很轻量,没有守护进程,解决方案如下:

生成systemd文件:
podman generate systemd --name your-container-name --files --new
上述your-container-name是你正在运行的容器,会自动提取对应参数
sudo mv container-your-cont[......]

继续阅读