Home:ALL Converter>Docker buildx gives exit code: 137 with cargo

Docker buildx gives exit code: 137 with cargo

Ask Time:2022-12-01T22:51:39         Author:J. Doe

Json Formatter

I know exit code 137 represents an OOM exception. I raised already my memory to 12 GB allocated to Docker and restarted my computer. I am still getting this error while running docker buildx. The regular docker build works perfectly. I am on a stock Mac Studio.

This is my failing command:

docker buildx build --platform linux/amd64 -t test4 .

Logs:

 > [builder 4/4] RUN cargo build --release:
#0 1.882     Updating crates.io index
#0 46.86 Killed
------
Dockerfile:8
--------------------
   6 |     COPY . .
   7 |     
   8 | >>> RUN cargo build --release
   9 |     
  10 |     FROM debian:11.5
--------------------
error: failed to solve: process "/bin/sh -c cargo build --release" did not complete successfully: exit code: 137

Dockerfile:

FROM rust:1.65.0-bullseye AS builder

WORKDIR app

COPY . .

RUN cargo build --release

FROM debian:11.5
WORKDIR app

COPY --from=builder ./app/target/release/hello ./hello

CMD ["./hello"]

It is a hello world program written in Rust.

Author:J. Doe,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/74643818/docker-buildx-gives-exit-code-137-with-cargo
yy