oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
72.07k stars 2.58k forks source link

Docker container exits with code 137 #5507

Open misinglink opened 10 months ago

misinglink commented 10 months ago

What version of Bun is running?

1.0.1+31aec4ebe325982fc0ef27498984b0ad9969162b

What platform is your computer?

Darwin 22.5.0 arm64 arm

What steps can reproduce the bug?

Here is my Dockerfile:

FROM --platform=arm64 oven/bun:canary
ENV NODE_ENV production

# Install Doppler CLI
RUN apt-get update && apt-get install -y apt-transport-https ca-certificates curl gnupg && \
    curl -sLf --retry 3 --tlsv1.2 --proto "=https" 'https://packages.doppler.com/public/cli/gpg.DE2A7741A397C129.key' | gpg --dearmor -o /usr/share/keyrings/doppler-archive-keyring.gpg && \
    echo "deb [signed-by=/usr/share/keyrings/doppler-archive-keyring.gpg] https://packages.doppler.com/public/cli/deb/debian any-version main" | tee /etc/apt/sources.list.d/doppler-cli.list && \
    apt-get update && \
    apt-get -y install doppler

RUN bun i -g typescript

WORKDIR /usr/src/app
COPY package.json .
COPY bun.lockb .

RUN bun install --frozen-lockfile
ADD . /usr/src/app

CMD ["bun", "--smol", "start:doppler"]

When I remove the doppler installation and replace the CMD line with

CMD  ["bun", "src/index.ts"]

I get no error message and the container just dies.

What is the expected behavior?

I expect the container to run as it does locally.
I would also expect more descriptive error message when something goes wrong. Bun is able to execute the files with bun src/index.ts outside the docker container just fine.

Screenshot 2023-09-15 at 4 21 30 PM

What do you see instead?

This is a screenshot of the logs of the container that just dies:

Screenshot 2023-09-15 at 4 22 00 PM

Additional information

The image built and ran just fine on a machine with the following OS:

Linux 5.15.0-83-generic x86_64 x86_64
Side Note on error messages

I had a config error earlier where the progream wasn't finding the redis instance, and I couldn't figure it out based on the bun error message. I had to run the program with node and got a more descriptive error message.

This isn't part of the issue but it would make debugging easier and allow to post more descriptive steps on how to reproduce this issue

ghost commented 10 months ago

+1

ChandlerVS commented 7 months ago

I am having this same issue. bun src/index.ts runs just fine outside the container, but inside it exits with code 137.

EDIT: The issue does not exist on debian based images. Only on alpine based images.