报错字典 / Hermes Agent / s6-supervise (exit 127)

容器重启死循环:s6-supervise app: fatal: unable to exec run (exit 127)

容器镜像换代缺少 bash 或 entrypoint.sh 包含 Windows CRLF 换行符。

原始报错与特征码

2026-11-08
s6-supervise app: fatal: unable to exec run: file does not exist (exit code 127). Container hermes-agent restarting in 1s...

根本原因分析

S6-overlay 进程守护框架在启动主程序服务时,报 127 通常有两个原因:一是脚本首行的 #!/bin/bash 在精简 Alpine 镜像中不存在(Alpine 默认只有 /bin/sh);二是执行脚本在 Windows 检出时被强行改成了 CRLF 换行符,Linux 将 \r 当成可执行文件名抛出 127。

可复制解法与生产配置

  1. 在宿主机执行 dos2unix <run_script> 剔除回车符;
  2. 检查脚本第一行 shebang,统一规范为跨平台通用的 #!/usr/bin/env sh 或 #!/bin/sh;
  3. 检查文件可执行权限:chmod +x /etc/services.d/app/run。