Using the Envoy Docker Image

    These instructions are known to work for the x86_64 and arm64 architectures.

    If you would like to use Envoy with docker-compose you can overwrite the provided configuration file by using a volume.

    If you use this method, you will have to ensure that the envoy user can read the mounted file either by ensuring the correct permissions on the file, or making it world-readable, as described below.

    Create a simple Dockerfile to execute Envoy.

    If you create a custom envoy.yaml you can create your own Docker image with it using the following Dockerfile recipe:

    1. FROM envoyproxy/envoy:v1.20.0
    2. COPY envoy.yaml /etc/envoy/envoy.yaml

    Build the Docker image using:

    Assuming Envoy is configured to listen on ports 9901 and 10000, you can now start it with:

    1. $ docker run -d --name envoy -p 9901:9901 -p 10000:10000 envoy:v1

    By default, the Envoy Docker image will start as the root user but will switch to the envoy user created at build time, in the Docker ENTRYPOINT.

    In this case the container will not attempt to drop privileges, but you will still need to ensure that the user running inside the container has any required permissions, as described below.

    The default uid and gid for the envoy user are 101.

    The uid and gid of this user can be set at runtime using the ENVOY_UID and ENVOY_GID environment variables.

    This can be done, for example, on the Docker command line:

    This can be useful if you wish to restrict or provide access to unix sockets inside the container, or for controlling access to an Envoy socket from outside of the container.

    To run the process inside the container as the root user you can set ENVOY_UID to 0, but doing so has the potential to weaken the security of your running container.

    The envoy image sends application logs to /dev/stdout and /dev/stderr by default, and these can be viewed in the container log.

    If you send application, admin or access logs to a file output, the user will require the necessary permissions to write to this file. This can be achieved by setting the ENVOY_UID and/or by making the file writeable by the envoy user.

    1. $ mkdir logs
    2. $ chown 777 logs
    3. $ docker run -d --name envoy -v $(pwd)/logs:/var/log -e ENVOY_UID=777 envoyproxy/envoy:v1.20.0

    You can then configure envoy to log to files in /var/log

    The envoy user also needs to have permission to access any required configuration files mounted into the container.

    Any binary files specified in the configuration should also be executable by the envoy user.

    If you are running in an environment with a strict umask setting, you may need to provide envoy with access by setting the ownership and/or permissions of the file.

    One method of doing this without changing any file permissions is to start the container with the host user’s uid, for example:

    Unix-based systems restrict opening well-known ports (ie. with a port number < 1024) to the root user.

    If you need to listen on a well-known port you can use Docker to do so.

    For example, to create an Envoy server listening on port 8000, with forwarding from port :