Docker Compose
Introduction
This document provides a complete example of how to deploy Defguard using Docker Compose, including configuration for all components – Core, Edge, 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, Edge, and Gateway components physically separated.
Please note that we also offer Docker Compose deployment with one-line quick deployment, but this method is recommended for PoC/quick deployment as it launches everything on one server and all services in one docker compose.
Docker images and tags
We use latest (latest production images) tags in the examples below, but other tags, like full release versions (for example, 2.0.0) can be used as well.
All docker images for Core, Gateway, and Edge 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.
All available Docker images are available in the links below:
Example Docker Compose deployment repository
We prepared a dedicated git repository with and example Docker Compose configuration files.
Deploying Core and PostgreSQL services
Here is the docker-compose.yaml file for Defguard Core and PostgreSQL database. Configuration is split into the .env file (see below):
To run the service with Docker Compose, execute this command:
Optional nginx reverse-proxy
Depending on your infrastructure, you may choose to keep the setup simple and let Defguard handle SSL termination for you. Learn more about this functionality here. In that case skip stis step.
Alternatively, you can place a reverse proxy in front of your Core service to manage SSL termination.
Here is an example nginx configuration to provide SSL termination:
Deploying Edge
Here is the docker-compose.yaml file for Defguard Edge.
Optional nginx reverse-proxy
Depending on your infrastructure, you may choose to keep the setup simple and let Defguard handle SSL termination for you. Learn more about this functionality here. In that case skip stis step.
Alternatively, you can place a reverse proxy in front of your Edge service to manage SSL termination.
Here is an example nginx configuration to provide SSL termination:
Deploying Gateway service
Here is the docker-compose.yaml file for Defguard Gateway.
Upgrading
Always back up your database before upgrading Core. See the deployment overview for instructions.
Review the migration guides for breaking changes that may affect your setup. See migration guides.
Update the image tags in your
docker-compose.yamlfiles for each component:Pull the new images and restart:
Verify all services are up:
Downgrading
Downgrading after a database migration has run is not trivial and may require restoring from a backup. Database migrations are applied automatically when Core starts. Always back up before upgrading.
Last updated
Was this helpful?