0

I use ENTRYPOINT["./app"] in dockerfile, when I use the other larger image, it was work

But when I used alpine, it told me exec ./app: no such file or directory

And I'm sure the file is exist in container

I'm guess alpine doesn't have bash, so I try to use RUN apk update && apk add bash, but it still not work

What's wrong?

Here is my dockerfile:

FROM        golang AS build
WORKDIR     /app
COPY        . .
RUN         cd ./src && go build -o ../bin/app
RUN         rm -r src/ .vscode/ .git/

FROM    alpine AS release
COPY    --from=build /app /app

WORKDIR     /app/bin
ENTRYPOINT ["./app"]

And this is container content:

enter image description here

Even I install bash, it still not found

Also I just forgot to say, docker runs on the wsl2

  • Can you share the full Dockerfile? – David T. Nov 10 '22 at 14:09
  • Alpine doesn't use bash by default: https://stackoverflow.com/questions/44803982/how-do-i-run-a-bash-script-in-an-alpine-docker-container – Christoph Fischer Nov 10 '22 at 14:26
  • You're building on a Debian-based image, but trying to run the application on an Alpine-based image. Does it help to make these distributions line up, as suggested in [docker can't run a go output file that already exist](https://stackoverflow.com/questions/55200508/docker-cant-run-a-go-output-file-that-already-exist)? – David Maze Nov 10 '22 at 15:15

1 Answers1

0

You have to investigate the reasons.

I suggest you to put the following lines to inspect the presence of the executable file where you should run it:

RUN pwd
RUN ls -l
Antonio Petricca
  • 8,891
  • 5
  • 36
  • 74