代码之家  ›  专栏  ›  技术社区  ›  Dolphin

standard_init_linux.go:228:exec用户进程导致:使用发行版构建rust应用程序时没有这样的文件或目录

  •  0
  • Dolphin  · 技术社区  · 2 年前

    当我使用 static-debian11 作为运行rust应用程序的基本映像,显示错误:

    standard_init_linux.go:228: exec user process caused: no such file or directory
    

    这是 main.rs 以下为:

    fn main() {
        print!("hello world");
    }
    

    这是码头文件:

    # build stage
    FROM rust:1.54-bullseye as builder
    WORKDIR /app
    COPY . /app
    RUN rustup default stable
    RUN cargo build --release
    # RUN cargo build
    # do not use slim image, will block when query database
    FROM gcr.io/distroless/static-debian11
    LABEL maintainer="jiang@gmail.com"
    WORKDIR /app
    ENV ROCKET_ADDRESS=0.0.0.0
    # ENV ROCKET_PORT=11014
    COPY --from=builder /app/.env /app
    COPY --from=builder /app/settings.toml /app
    
    COPY --from=builder /app/target/release/alt-server /app/
    CMD ["/app/alt-server"]
    

    这是cargo.toml:

    [package]
    name = "alt-server"
    version = "0.1.0"
    edition = "2021"
    
    [dependencies]
    

    我已经在使用 dive 检查docker图像并确保 /app/alt-server 存在。我是不是错过了什么?

    0 回复  |  直到 2 年前
    推荐文章