dockers
dockers copied to clipboard
Allow CGO_ENABLED=1
Dynamically linked Go applications compiled with CGO_ENABLED=1 on a system with glibc (default on debian based distros) instead of musl (default on alpine) can now run inside an iron/go container.
Initially I tested only with a simple program that printed something to the screen and it worked, but after I started using CGO_ENABLED=1 features such as golang plugins, I got the same error as you. I ended up using https://github.com/frol/docker-alpine-glibc, which has a real glibc inside an alpine container, instead of trying to make musl look like glibc via symlinks.
The work around proposed here only seems to work when compiling a program with CGO_ENABLED=1, but not using features that require dynamic linking or linking with C programs, which is indeed not very useful.
In theory musl and glibc should be compatible and there should be a way to make CGO_ENABLED=1 work with just musl installed, but it seems that the proposed symlink is not sufficient.
Feel free to reject this pull request for now, if I come up with a better solution, I'll make another.