You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

系统重启后Podman容器无法自动启动,启动后因SIGTERM退出

VM重启后Podman容器启动后因SIGTERM退出,需实现自动重启

需求明确:VM完成重启后,Podman容器需自动重启。当前两个容器均可启动,但随即因SIGTERM信号退出。我们在运行Ubuntu 22.04.2 LTS的VM上执行了以下命令:

podman-compose -f projects/04_floof/podman-compose.yml down && podman-compose -f projects/04_floof/podman-compose.yml up -d

针对该问题,我们尝试了多种方案,但结果一致:

  • 通过crontab配置
  • crontab结合nohup
  • crontab结合disown
  • crontab结合screen
  • 使用systemd

以下是podman-compose.yml内容:

version: "3.9"
services:
    04_floof:
        container_name: 04_floof
        image: docker.io/myrepo/04_floof:latest
        networks:
            - floof-internal
    cf_04_floof:
        container_name: cf_04_floof
        image: docker.io/cloudflare/cloudflared:latest
        command: tunnel --no-autoupdate run --token XXXXXXXXXXXXX
        networks:
            - floof-internal
networks:
    floof-internal: {}

以下是其中一个容器的日志,显示其因SIGTERM退出:

user@vm3:~$ podman logs 04_floof 
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf differs from the packaged version
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2023/04/16 13:07:48 [notice] 1#1: using the "epoll" event method
2023/04/16 13:07:48 [notice] 1#1: nginx/1.23.3
2023/04/16 13:07:48 [notice] 1#1: built by gcc 10.2.1 20210110 (Debian 10.2.1-6) 
2023/04/16 13:07:48 [notice] 1#1: OS: Linux 5.15.0-69-generic
2023/04/16 13:07:48 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2023/04/16 13:07:48 [notice] 1#1: start worker processes
2023/04/16 13:07:48 [notice] 1#1: start worker process 23
2023/04/16 13:07:48 [notice] 1#1: start worker process 24
2023/04/16 13:11:06 [notice] 1#1: signal 15 (SIGTERM) received, exiting
2023/04/16 13:11:06 [notice] 23#23: signal 15 (SIGTERM) received, exiting
2023/04/16 13:11:06 [notice] 23#23: exiting
2023/04/16 13:11:06 [notice] 24#24: exiting
2023/04/16 13:11:06 [notice] 23#23: exit
2023/04/16 13:11:06 [notice] 24#24: exit
2023/04/16 13:11:06 [notice] 1#1: signal 15 (SIGTERM) received, exiting
2023/04/16 13:11:06 [notice] 1#1: signal 17 (SIGCHLD) received from 24
2023/04/16 13:11:06 [notice] 1#1: worker process 24 exited with code 0
2023/04/16 13:11:06 [notice] 1#1: signal 29 (SIGIO) received
2023/04/16 13:11:06 [notice] 1#1: signal 17 (SIGCHLD) received from 23
2023/04/16 13:11:06 [notice] 1#1: worker process 23 exited with code 0
2023/04/16 13:11:06 [notice] 1#1: exit

内容的提问来源于stack exchange,提问作者ratlan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.24 22:17:47