Repository navigation
Description
Description:
I'm trying to run envoy-gateway in standalone mode in a container using
provided image envoyproxy/gateway:v1.2.4. I'm reproducing steps from article Standalone Deployment Mode but instead of binary image mentioned above is used.
The envoy binary successfully got downloaded but can't start with no such file or directory error.
This is common error when trying to run dynamically linked binary in a distroless image.
Instead of an error envoy should be able to start inside running container.
Repro steps:
Here are steps to reproduce, requires installed docker:
# Put standalone.yaml file from the article in the docs (only 'paths' field changed)
$ cat << EOF > /tmp/standalone.yaml
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: EnvoyGateway
gateway:
controllerName: gateway.envoyproxy.io/gatewayclass-controller
provider:
type: Custom
custom:
resource:
type: File
file:
paths: ["/tmp/envoy-gateway/config"]
infrastructure:
type: Host
host: {}
logging:
level:
default: debug
extensionApis:
enableBackend: true
EOF
# Create directory for configs and widen the permissions (needed to be accessible inside container)
$ mkdir -p /tmp/envoy-gateway/config
$ sudo chmod -R 777 /tmp/envoy-gateway/
# Generate certificates and put them in a mounted directory
$ docker run --rm -v /tmp/envoy-gateway:/tmp/envoy-gateway envoyproxy/gateway:v1.2.4 certgen --local
2025-01-10T21:51:13.559Z INFO cmd/server.go:106 No config file provided, using default parameters
2025-01-10T21:51:14.318Z INFO cmd/certgen.go:71 generated certificates {"path": "/tmp/envoy-gateway/certs"}
# Download quickstart.yaml
$ wget -q https://raw.githubusercontent.com/envoyproxy/gateway/refs/heads/main/examples/standalone/quickstart.yaml -O /tmp/envoy-gateway/config/quickstart.yaml
# Start 'envoy-gateway' with created config
$ docker run --rm -v /tmp/envoy-gateway:/tmp/envoy-gateway -v /tmp/standalone.yaml:/tmp/standalone.yaml envoyproxy/gateway:v1.2.4 server --config-path /tmp/standalone.yaml
. . .
downloading https://archive.tetratelabs.io/envoy/download/v1.32.3/envoy-v1.32.3-linux-amd64.tar.xz
starting: /tmp/envoy-gateway/versions/1.32.3/bin/envoy --service-cluster envoy-gateway-system/eg --service-node envoy-gateway-system-eg-5391c79d --config-yaml ...
. . .
2025-01-10T22:26:47.825Z ERROR infrastructure runner/runner.go:104 failed to create new infra {"runner": "infrastructure", "error": "unable to start Envoy process: fork/exec /tmp/envoy-gateway/versions/1.32.3/bin/envoy: no such file or directory"}
2025-01-10T22:26:47.825Z ERROR watchable message/watchutil.go:56 observed an error {"runner": "infrastructure", "error": "unable to start Envoy process: fork/exec /tmp/envoy-gateway/versions/1.32.3/bin/envoy: no such file or directory"}Since binary successfully downloaded and now stored on the host we can do more experiments.
Running envoy binary inside gcr.io/distroless/static:nonroot which is used to build envoy-gateway image (see envoyproxy/gateway/tools/docker/envoy-gateway/Dockerfile):
$ docker run --rm -v /tmp/envoy-gateway:/tmp/envoy-gateway gcr.io/distroless/static:nonroot /tmp/envoy-gateway/versions/1.32.3/bin/envoy --version
exec /tmp/envoy-gateway/versions/1.32.3/bin/envoy: no such file or directoryNow running the same binary using gcr.io/distroless/base-nossl-debian12:nonroot which is used to build envoy image (see envoyproxy/envoy/ci/Dockerfile-envoy):
$ docker run --rm -v /tmp/envoy-gateway:/tmp/envoy-gateway gcr.io/distroless/base-nossl-debian12:nonroot /tmp/envoy-gateway/versions/1.32.3/bin/envoy --version
/tmp/envoy-gateway/versions/1.32.3/bin/envoy version: 58bd599ebd5918d4d005de60954fcd2cb00abd95/1.32.3/Clean/RELEASE/BoringSSLTo ensure what the binary is dynamically linked linux command file can be utilised:
$ sudo file /tmp/envoy-gateway/versions/1.32.3/bin/envoy
/tmp/envoy-gateway/versions/1.32.3/bin/envoy: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=58bd599ebd5918d4d005de60954fcd2cb00abd95, strippedEnvironment:
Linux x64, docker
Activity
arkodg commentedon Jan 10, 2025
cc @mathetake
mathetake commentedon Jan 11, 2025
this is not an issue of either envoy or envoy gateway. envoy binaries are NOT fully static binary but as you see dynamically linked to glibc just like normal c/c++/rust applications, not possible to execute in the environment without glibc. maybe you want to try building envoy with musl libc to produce the fully static binary but i don't think it would be worth your effort vs the gain.
arkodg commentedon Jan 11, 2025
thanks @mathetake, would it help if we swapped out the base image from https://github.com/envoyproxy/gateway/blame/8dbe6e00d733a88c579a05cdd9ffd62f5b83907f/tools/docker/envoy-gateway/Dockerfile#L7 to another distroless base image like
gcr.io/distroless/base-nosslhttps://github.com/GoogleContainerTools/distroless/blob/main/base/README.md#documentation-for-gcriodistrolessbase-gcriodistrolessbase-nossl-and-gcriodistrolessstaticthe goal here is to reuse the gateway container image in standalone mode
mathetake commentedon Jan 11, 2025
yeah that might help i guess (i thought the issue was to run envoy in distroless-static, which is not possible as i mentioned, but it seems like the request here is the other way around)
arkodg commentedon Jan 11, 2025
yeah @denniskniep was trying to run standalone envoy-gateway in the envoy-gateway container itself, which would fork a envoy process !
tried out
gcr.io/distroless/base-nossland it works, image size increases by ~6MBuse distroless-base-nossl image
arkodg commentedon Jan 11, 2025
hey @dshatokhin raised #5034 to address this, would be great if you can enhance the docs to include your steps in the standalone doc once the PR is in.
cc @shawnh2
dshatokhin commentedon Jan 12, 2025
@arkodg sure, I would like to help the project 😊
use distroless-base-nossl image (envoyproxy#5034)