I’m having a problem while running container. In my project there are 3 different containers (one for the backend, one for the frontend and one for mongodb), the last two works fine but the first (the one for the backend) gives me the following error:
backend-1 | backend: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by backend)
backend-1 | backend: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by backend)
backend-1 | backend: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by backend)
And exit with status code: 1
This is the dockerfile
# Stage 1: Build the Rust app
FROM rust:1.76 as builder
WORKDIR /app
# Cache dependencies
COPY Cargo.toml Cargo.lock ./
RUN mkdir src
RUN echo "fn main() {}" > src/main.rs
RUN cargo build --release
RUN rm -rf src
# Copy source code and build the project
COPY . ./
RUN cargo build --release
# Stage 2: Create a lightweight image for the Rust app
FROM debian:buster-slim
RUN apt-get update && apt-get upgrade -y && apt-get install -y libssl1.1 ca-certificates && rm -rf /var/lib/apt/lists/*
COPY --from=builder /app/target/release/backend /usr/local/bin/backend
EXPOSE 8080
CMD ["backend"]
and this is the docker-compose file
version: '3.8'
services:
frontend:
build:
context: ./frontend
ports:
- "3000:80"
depends_on:
- backend
backend:
build:
context: ./backend
ports:
- "8080:8080"
environment:
MONGO_URL: "mongodb://mongo:27017/wellness-tracker"
depends_on:
- mongo
mongo:
image: mongo:5.0
volumes:
- mongo-data:/data/db
ports:
- "27017:27017"
volumes:
mongo-data:
I’ve tried changing several distro, like
Ubuntu (20.04/21.*/22.04)
rust:1.76-slim-buster -> both on the first and second stage (cause someone suggested that I have a glibc mismatch, because build for glibc Version A, but deploy the binary to Version C)
And using simplified dockerfile but still nothing.
I already tried the solution suggested in a question with the same error but still nothing for me…
Ghignatti Nicolò is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.