是否可以使用 podman 更改容器重启策略?我们可以在创建容器时设置策略podman run --restart always,但是创建容器时如何更改策略呢?
使用 docker,我们docker update可以使用命令来执行此操作。不幸的是没有podman update命令。能做到吗?或者我需要创建一个新容器?
小智 4
使用 podman 时,您应该创建一个 systemd 服务来管理 podman 容器。
Run Code Online (Sandbox Code Playgroud)[Unit] Description=your container [Service] Restart=always ExecStart=/usr/bin/podman start -a containername ExecStop=/usr/bin/podman stop -t 2 containername [Install] WantedBy=local.target
systemctl 守护进程重新加载
systemctl 启用容器名称.service
systemctl restart 容器名.service
您还可以添加一些其他重新启动 systemd 参数,例如:
RestartSec (Configures the time to sleep before restarting a service), StartLimitInterval (seconds service is it not permitted to start any more), StartLimitBurst
Run Code Online (Sandbox Code Playgroud)
有关更多详细信息,请查看手册页:“man systemd.service”
| 归档时间: |
|
| 查看次数: |
7144 次 |
| 最近记录: |