On Debian/Ubuntu, the protobuf-compiler package ships the protoc binary but not the “well-known type” .proto files (google/protobuf/timestamp.proto, wrappers.proto, any.proto, …). Any tonic/prost build whose .proto files import a well-known type will fail at compile time in the image unless you also install libprotobuf-dev.
For Agents
Building a Docker/CI image for a Rust gRPC service (
tonic-build/prost-buildinbuild.rs)? If any vendored.protoimportsgoogle/protobuf/*, install bothprotobuf-compilerandlibprotobuf-dev. The second package is what drops the WKT.protosources into/usr/include/google/protobuf/whereprotoclooks for imports. Found building the solv1-rig image.
Symptom
Local cargo build works (your machine has a full protobuf install), but the Docker/CI build fails in build.rs with something like:
Import "google/protobuf/timestamp.proto" was not found or had errors.
or a tonic-build/prost-build panic unwrapping the compile_protos result.
Root Cause
protoc resolves import statements against its include path. The stock protobuf-compiler apt package installs only the compiler binary; the well-known-type descriptors (the .proto files under google/protobuf/) live in the separate libprotobuf-dev package. Without it, protoc has the compiler but nothing to resolve import "google/protobuf/…" against, so any proto that imports a WKT — directly or transitively — won’t compile.
This bites any tonic/prost image the moment a vendored proto pulls in a WKT. It does not reproduce locally when your dev box has a complete protobuf toolchain, so it surfaces first in the container build.
Fix
Install both packages in the builder stage:
RUN apt-get update && apt-get install -y --no-install-recommends \
protobuf-compiler \
libprotobuf-dev \
&& rm -rf /var/lib/apt/lists/*Quick checks
dpkg -L libprotobuf-dev | grep timestamp.protoshould list/usr/include/google/protobuf/timestamp.protoonce installed.- Alternatively,
prost/toniccan bundle a vendoredprotocvia theprotocfeature /protoc-bin-vendored, sidestepping the system package entirely — but if you rely on the aptprotoc, you needlibprotobuf-devalongside it.
Related
- solv1-rig-increment-1-build-2026-07-03 — surfaced building the rig’s
tonic/prostDocker image - rust-otel-logs-signoz-export — sibling Rust/gRPC infra gotcha from the same project
- yellowstone-grpc-proto-layout-versioning — proto-layout gotchas in the same build