How do I pass a config file to a Docker container in Qovery?

Last updated: December 1, 2025

Context

When deploying Docker containers in Qovery, you may need to pass configuration files as arguments to your container. This is particularly useful when working with images that require configuration files for proper operation (e.g., Grafana, Nginx, Redis, etc.).

Answer

To pass a configuration file to your Docker container in Qovery, follow these steps:

Step 1: Add the configuration file as a file-type environment variable

  1. Navigate to Console > Your Service > Variables tab in the left panel

  2. Click New Variable button

  3. Select "Variable as File" as the variable type

  4. Configure the variable:

    • Name: Set a descriptive name for your variable (e.g., MY_CONFIG or GF_PATHS_CONFIG)

    • Path: Specify the path where the file should be created inside the container (e.g., /etc/config.yaml or /etc/grafana/grafana.ini)

    • Value: Paste your configuration file content (only text files are supported)

    • Scope: Select the appropriate scope (Application, Environment, or Project)

    • Secret: Enable this option if your configuration contains sensitive information (credentials, API keys, etc.)

  5. Click Create to save the variable

Note: The variable name (key) will contain the path to the file at runtime. Your application can retrieve this path by reading the environment variable.

Step 2: Configure the container to use the config file

The CMD Arguments configuration differs based on your application source:

For applications deployed from a Git Repository:

  1. Go to Console > Your Service > Settings > General

  2. In the CMD Arguments field, add your arguments separated by spaces

    • Example: --config /etc/config.yaml

    • Complex example: rails -h 0.0.0.0 -p 8080 string "complex arg"

For applications deployed from a Container Registry:

  1. Go to Console > Your Service > Settings > General

  2. In the CMD Arguments field, use JSON array format

    • Example: ["--config", "/etc/config.yaml"]

    • Complex example: ["rails", "-h", "0.0.0.0", "-p", "8080", "string"]

Important: You can also set the Image Entrypoint if you need to override the default container entrypoint.

Step 3: Redeploy your application

Click Redeploy for the changes to take effect. The configuration file will be mounted at the specified path during container startup.

Important Limitations

  • Environment variables in CMD Arguments: Qovery does not support injecting environment variables directly in the entrypoint or CMD arguments (e.g., $MY_VAR won't be expanded). If you need this functionality, create a custom entrypoint script in your Dockerfile.

  • File type: Only text files are supported for "Variable as File" type.

  • Build time vs Runtime: File-type variables are only available at runtime, not during the Docker build phase. If you need files at build time, include them in your repository or use Docker build arguments.

Example: Grafana Configuration

Here's a practical example for overriding Grafana's default configuration:

  1. Create a Variable as File:

    • Name: GF_PATHS_CONFIG

    • Path: /etc/grafana/custom.ini

    • Value: Your grafana.ini content

  2. The Grafana container will automatically use the GF_PATHS_CONFIG environment variable to locate and load your custom configuration file.

Related Documentation