Docker Compose
Introduction
This document provides a complete example of how to deploy Defguard using Docker Compose, including configuration for all components - Core, Proxy, and Gateway. It covers Docker image tags, environment variables, and reverse-proxy setup examples to help you quickly launch a fully functional Defguard environment.
We recommend deploying each Defguard service on a dedicated server or virtual machine to ensure better isolation, performance, and security. In this setup, each Docker Compose file should be used for a single service, keeping the Core, Proxy, and Gateway components physically separated.
Docker images and tags
We use latest (latest production images) tags in the examples below, but you can use others.
All docker images for Core, Gateway, and Proxy have these additional tags:
latest- the latest stable production release.vX.Y,vX.Y.Z,vX.Y-alpha1- fixed tags for specific stable and alpha releases.pre-release- the latest pre-production release (equivalent to vX.Y-alpha1).dev- the latest development build from the dev branch (experimental).
We recommend always using fixed, stable tags (vX.Y, vX.Y.Z) for your production deployment.
Example Docker Compose deployment repository
We prepared a git repository with and example Docker Compose configuration.
To run your services using this example prepare your .env file by copying the template:
Finally, run the service with Docker Compose:
Below you'll find a detailed breakdown of configuration for different components: Core, Proxy and Gateway.
Deploying Core, database and reverse proxy services
Here is the docker-compose.yaml for the core and database. Configuration is split to the .env file (see below):
NGINX reverse-proxy
Now that you have core running, here is an example NGINX configuration to provide SSL termination:
The configuration
Here is the .env file with all configuration variables:
Deploying Proxy and reverse proxy service
Here is the docker-compose.yaml for the public proxy (enrollment service as well as desktop client configuration service).
To secure the gRPC communication, please generate the proxy CA and certificate, more info here.
NGINX reverse-proxy
Now that you have proxy running, here is an example NGINX configuration to provide SSL termination:
Deploying Gateway service
Before deploying a new Gateway service, make sure you have a running Defguard Core instance.
On the network level, your Gateway must be able to reach the Core service’s gRPC endpoint. This address is passed as the DEFGUARD_GRPC_URL parameter when deploying the Gateway. The Gateway uses it to communicate with Core, fetch its configuration, and publish operational statistics.
You’ll also need a Location created in the Defguard Core Admin Panel.
Each Location is identified by a unique token, which must be provided to the Gateway as the DEFGUARD_TOKEN parameter. The Gateway uses this token to authenticate with Core over the gRPC channel and retrieve the correct configuration for that specific Location. For detailed steps on how to create a Location and obtain its token, see this section.
For the most basic configuration use the following Docker Compose file:
Last updated
Was this helpful?