Containerizing the Apollo Router
Find our more about the Apollo Router images here.
Each release of the Apollo Router includes both default and debug images. Each image for a release contains the same build. Debug images additionally contain a "busybox" to help with container debugging.
Here's a basic example of running a router image with Docker (make sure to replace <image version>
with whichever version you want to use, such as v0.1.0-preview.1
):
Note: The Apollo Router is made available under the Elastic License v2.0 (ELv2). This applies to its source code and all distributions, including versions embedded within a Docker image. Read our licensing page for more details.
docker run -p 4000:4000 \--env APOLLO_GRAPH_REF="<your graph>" \--env APOLLO_KEY="<your key>" \--rm \ghcr.io/apollographql/router:<image version>
This command downloads your supergraph schema from Apollo and uses a default configuration that listens for connections on port 4000
.
For more complex configuration (such as overriding subgraph URLs or propagating headers), see Configuring the Apollo Router.
For examples of using router images in specific environments, see the guides for Docker and Kubernetes.
Image file layout
- The router executable is located in the
/dist
directory. - A default configuration file,
router.yaml
, is located in thedist/config
directory. - There is also a
/dist/schema
directory for convenient mounting of a locally defined supergraph schema. - Licensing details are also available in the
/dist
directory.
Image build
Apollo Router images are based on distroless, which is designed to provide constrained, secure, and small images.