How to run separate containers for separate config files

Hi

I have a below project dir:

MyProject:
  configs
    client1.json
    client2.json
    client3.json
app.py

I have created a docker image. I want to run three containers for each of the three client. Each of them should use their own defined configs. As of now I am just using the below dockerfile because I just had 1 config file. But is there a way to define which config file to use which starting a container

# syntax=docker/dockerfile:1

FROM python:3.8-slim-buster

COPY requirements.txt requirements.txt

RUN pip3 install -r requirements.txt

COPY . .

CMD ["python3", "app.py"]

Three possible solutions come to mind:

  • Introduce an environment variable with the name of the config file and then leverage it from your python code to load the config based on the environment variable
  • Write an entrypoint script that uses environment variables to either update an existing or generate a config file based on variable
  • Use a volume to bind a configuration from the host into the container.

From my perspective, it should be avoided to add environment specific configurations into an image.