-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Docker scratch container failed to start with collecor built by ocb tool #6373
Comments
The same problem with golang alpine images. |
I ran into the same issue, so I checked how the official otel collector images are built: https://github.com/open-telemetry/opentelemetry-collector-releases/blob/main/.goreleaser.yaml The trick seems to be setting Here is a Dockerfile that works for me (you might need to enable buildkit, see: https://docs.docker.com/build/buildkit/#getting-started).
|
@lesovsky, can you confirm that setting |
yes, it works with CGO_ENBALED=0, thanks! |
Describe the bug
Container with collector (built with ocb) and based on
scratch
is failed to start with error:exec /otelcol: no such file or directory
.Steps to reproduce
Prepare builder.yaml config for
ocb
:Build the collector
Also put otel-collector from this repo into ./build directory.
Check both binaries, it works:
Prepare Dockerfile (puth both binaries into image)
Build it with
docker build otel-collector:dev .
Run containers and try to exec both binaries - official collector works as intended.
Collector build manually is not executed:
At the same time, both binaries are present in the image
Unpacking image show that both binaries have proper permissions (+x) and could be executed succesfully.
I checked configs many times, tried to reproduce that from scratch, tried to use ENTRYPOINT instead of CMD, but had no success.
But if i use
FROM golang
instead of scratch - it's working fine. I don't understand what the root cause of the issue and why it isn't working withscratch
only.What did you expect to see?
I expect that binary created by
ocb
could be executed in docker container created fromscratch
What did you see instead?
Container failed to start and return error about executable not found
What version did you use?
ocb: 0.62.1 (installed by go install ...)
Environment
OS: Ubuntu 20.04
Golang: 1.18.7
Docker version 20.10.17, build 100c701
The text was updated successfully, but these errors were encountered: