Jah*_*kib 18 linux ubuntu rust rust-cargo actix-web
这是我的 Docker 文件:
FROM ubuntu:20.04
RUN apt-get update && apt-get upgrade -y
RUN apt-get install libssl-dev
RUN apt-get install -y -q build-essential curl
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
WORKDIR /command-agent
COPY . /command-agent
RUN cargo build --release
COPY /command-agent/target/release/command-agent /
EXPOSE 8080
ENTRYPOINT command-agent
Run Code Online (Sandbox Code Playgroud)
它成功构建了 docker 映像,但是当我运行该容器时,它给出了错误:
命令代理:/lib/x86_64-linux-gnu/libc.so.6:找不到版本“GLIBC_2.34”(/command-agent/command-agent 需要)
我不明白,我该如何解决这个问题?
/target当我避免目录并且现在使用ubuntu 20.04和的两个版本时,它对我有用21.10。感谢@Charles Duffy和@Herohtar的重要且有用的指导,
FROM ubuntu:21.10
RUN apt-get update && apt-get upgrade -y
RUN apt-get install libssl-dev
RUN apt-get install -y -q build-essential curl
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
WORKDIR /command-agent
COPY ./src/. /command-agent/src/
COPY .env /command-agent/
COPY Cargo.toml /command-agent/
COPY Cargo.lock /command-agent/
RUN cargo build --release
EXPOSE 8080
ENTRYPOINT /command-agent/target/release/command-agent
Run Code Online (Sandbox Code Playgroud)