OpenFeature is an open standard that makes it possible to implement the concept of feature flags, on or off features of an application. To use OpenFeature, we need to have a service running outside the application that acts as a provider so that we can control when to turn on and when to turn off a feature of the application. There are many providers that support OpenFeature, one of which is the open source flagd provider. In this tutorial, I will show you how to install this flagd provider using Docker Compose!
First, to install the flagd provider using Docker Compose, we will need the Docker Image of the flagd provider. You can find the Docker images of flagd on the GitHub Container Registry here https://github.com/open-feature/flagd/pkgs/container/flagd. Depending on your needs, you can choose the tag of the flagd provider accordingly. I will use the latest version.
The content of the Docker Compose file to install the flagd provider will look like this:
command: start --uri file:/etc/flagd/flags.flagd.json
You need to map a directory outside the container with the directory /etc/flagd inside the container and define a configuration file about the feature flag so that the flagd provider can read and process, in the directory outside this container.
When running a Docker Container from a Docker Image, the flagd provider will need to run the “start” command with a parameter pointing to the configuration file about the feature flag.
By default, the flagd provider will run on port 8013, so you also need to expose this port to the outside so that applications can connect and work with the flagd provider!
The result when I run the command “docker compose up” with the file docker-compose.yaml containing the above content is as follows:
So we have successfully installed the OpenFeature flagd provider, guys!