Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facing issue while running prebuild binaries in alpine docker container #1

Closed
deekshith-elear opened this issue Mar 25, 2019 · 1 comment

Comments

@deekshith-elear
Copy link

Hi,
I'm trying to run simple hello.c binary which is built in my machine and created docker image for it using alpine as base image

Code compilation

gcc hello.c -o hello

DOCKER FILE

FROM alpine:3.4
RUN apk add --update gcc libc-dev
COPY hello /usr/bin/

DOCKER CONTAINER

1. docker build . -t helloworld:1
2. docker run --rm -it helloworld:1
3. /bin/sh: hello: not found

can anyone help me out to resolve this issue

@ncopa
Copy link
Contributor

ncopa commented Apr 3, 2019

You need to build it against musl libc. You cannot really copy in a binary built on MacOS, Windows or GNU/Linux and expect it to run in Alpine. Well, you can run Windows binary with wine and you may be able to run GNU/Linux binary if you install either libc6-compat or gcompat. It may work, even if there are no guarantee that it does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants