Skip to content
Advertisement

“protoc: not found” on an Alpine-based Docker container running Protocol Buffers

I’m trying to build a simple container which downloads a Protocol Buffers binary from the release page (https://github.com/protocolbuffers/protobuf/releases/tag/v3.13.0) and adds it to the path. Following the Linux instructions at http://google.github.io/proto-lens/installing-protoc.html, I’ve attempted the following Dockerfile:

JavaScript

The problem is that if I build it using

JavaScript

and run a shell in it, I get a protoc: not found error, even though the binary is in /usr/local/bin which is in the PATH:

JavaScript

It also occurred to me that I might have downloaded a version of protoc that is not runnable on Alpine Linux, but the linux-x86_64 suffix seems to match the architecture of the container:

JavaScript

Any idea why protoc can’t be executed in this container?

Advertisement

Answer

As pointed out by KamilCuk, Alpine uses musl as its C standard library whereas the binary was compiled against glibc. My solution was to use the golang base image (which is based on Buster Linux) rather than golang:alpine:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement