Technical questionAccepted answer
error "/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found"
Jahadul Rakib
Apr 15
0 views1
Here is My Dockerfile:
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
Its build successfully docker image but when I run that container its gives error:
command-agent: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /command-agent/command-agent)
I do not understand, How can I fix this issue ?
1 answer
Accepted answer · original discussion
Jahadul Rakib
PermalinkApr 15
ITs works for me when i avoid /target directory and now working both version of ubuntu 20.04 and 21.10. Giving thanks to @Charles Duffy and @Herohtar for their important and useful instruction,
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
3 question comments
Use comments to ask for clarification. Post a solution as an answer.
HerohtarPermalink
Apr 15
@CharlesDuffy has a good point. Unless you have a
.dockerignore file set up correctly, the target directory will also be copied, and then the cargo build command will not actually rebuild if you have already run the build locally.Charles DuffyPermalink
Apr 15
To be clear / explicit, you want to be sure the
target/ directory is ignored during the COPY.