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

CGO项目Docker镜像运行报错standard_init_linux.go:228求助

CGO Go服务在Alpine Docker镜像中启动报错

核心报错:standard_init_linux.go:228: exec user process caused: no such file or directory

已排除的原因

  • 非入口脚本存在CR换行导致
  • 因项目依赖CGO,无法通过设置CGO_ENABLED=0编译解决

环境与项目信息

  • C库安装路径:/usr/local/lib/sgp4/Linux/IFORT 和 /usr/local/lib/sgp4/Linux/GFORTRAN,包含多个.so文件
  • 已尝试设置环境变量LD_LIBRARY_PATH=/usr/local/sgp4/lib/Linux/IFORT
  • 项目包含一组wrapper .h文件及对应CGO注释(截图:CGO注释截图)
  • 二进制文件在Debian系统编译,必须运行在Alpine 3.17镜像中,编译阶段曾遇到librt.so.1缺失问题

当前Dockerfile配置

FROM [redacted]/alpine-base:3.17

RUN apk update && \
    apk add curl jq

COPY etc/cfg/propagator.properties /usr/local/[redacted]/etc/cfg/
COPY bin/sgp4 /usr/local/[redacted]/bin/sgp4
COPY propagator/wrappers /usr/local/[redacted]/bin/wrappers

# Download library files
RUN mkdir -p /usr/local/sgp4/lib
RUN curl --output /usr/local/sgp4/lib/SGP4.tar [redacted]/SGP4.tar
RUN tar -xf /usr/local/sgp4/lib/SGP4.tar -C /usr/local/sgp4/lib
RUN rm /usr/local/sgp4/lib/SGP4.tar
RUN export LD_LIBRARY_PATH=/usr/local/sgp4/lib/Linux/IFORT

RUN chmod a+rx /usr/local/[redacted]/bin/sgp4

RUN addgroup [redacted] && adduser -D -H -G [redacted] [redacted]
USER [redacted]:[redacted]

HEALTHCHECK NONE

ENTRYPOINT ["/usr/local/[redacted]/bin/sgp4", "-config-file-path=/usr/local/[redacted]/etc/cfg/propagator.properties"]

已尝试的无效操作

曾怀疑库文件存在CR换行,添加以下命令无效果:

RUN for filey in $(find /usr/local/sgp4/lib/Linux -type f); do echo $filey; sed -i 's/\r$//g' $filey; done
RUN for filey in $(find /usr/local/sgp4/lib/Linux -type f); do echo $filey; tr -d \r < $filey > tmp.so; mv tmp.so $filey; done

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.14 19:15:21