使用Podman Compose與設定自維護服務
先建立一個shell script:
podman-compose -f /[路徑]/docker-compose.yml down podman-compose -f /[路徑]/docker-compose.yml up podman-compose -f /[路徑]/docker-compose.yml down
然後建立一個service
[Unit] Description=[服務名稱] [Service] User=root WorkingDirectory=/[路徑] ExecStart=sh /[路徑]/[前面的shell script] Restart=always RestartSec=10s ExecStop=podman-compose -f /[路徑]/docker-compose.yml down [Install] WantedBy=multi-user.target
然後使用以下命令:
systemctl daemon-reload systemctl enable [服務名稱] systemctl start [服務名稱]
留言