monaco v1.7 and up can't be run in alpine container images
UnseenWizzard opened this issue · 3 comments
Describe the bug
When installing 1.7 or 1.8 in an image like: https://github.com/dynatrace-ace/monaco-runner/blob/master/Dockerfile.
docker run will fail:
docker run -e NEW_CLI=1 dynatraceace/monaco-runner:release-v1.8.0-dev "monaco version"
Error relocating /usr/bin/monaco: __vfprintf_chk: symbol not found
Error relocating /usr/bin/monaco: __fprintf_chk: symbol not found
How to reproduce
Steps to reproduce the behavior:
- get https://github.com/dynatrace-ace/monaco-runner/blob/master/Dockerfile
- install 1.8.0
- build as dynatraceace/monaco-runner:release-v1.8.0-dev
- docker run -e NEW_CLI=1 dynatraceace/monaco-runner:release-v1.8.0-dev "monaco -v"
Expected behavior
monaco runs and outputs version
Additional context
- There's no major changes to how the binary is built.
- Monaco is unchanged on Go 1.16 since 1.5.1 (0031be2#diff-33ef32bf6c23acb95f5902d7097b7a1d5128ca061167ec0716715b0b9eeaa5f6)
- this might be solved if building a static binary: try installing a version of this PR #579
How to reproduce the issue:
Simply compiling the program locally was not enough, to reproduce the issue do the following:
Execute the commands
CC=x86_64-linux-gnu-gcc CXX=x86_64-linux-gnu-g++ CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags ' -w -v -s' -o ./bin/monaco ./cmd/monaco
docker build . -t dynatraceace/monaco-runner:release-v1.8.0-local
docker run -e NEW_CLI=1 dynatraceace/monaco-runner:release-v1.8.0-local "monaco --version"
with this Dockerfile: (which is a smaller version of the above mentioned Dockerfile)
FROM alpine:latest
RUN apk add --update --no-cache curl jq ca-certificates bash nss unzip util-linux wget libc6-compat
COPY ./bin/monaco /usr/bin/monaco
RUN chmod +x /usr/bin/monaco
ENTRYPOINT ["/bin/bash", "-l", "-c"]
How we can fix it
By disabling CGO (CGO_ENABLED=0
) everything works already. It is not necessary to build a static binary, though, if we are at it, we could simply include it.
@UnseenWizzard wdyt? Simple fix, or full fix. I would not move the commands to the Makefile but update the GitHub Action.
What also has to be discussed: Re-release the 1.6, 1.7, and 1.8 binary? Aka new patch version?
My suggestion would be to release only 1.8.1 and update the referenced Dockerfile to download the latest release.
We will release this fix only for version 1.8.1.