Skip to main content
You will often see, when for example configuring providers, that the environment variables will look like this:
INSTAGRAM_CLIENT_ID=12345678901234567890
You have 2 options on how to set these variables in your docker-compose.yml file.

Option 1: Direct in docker-compose.yml

You can set them directly in the environment section of the service.
services:
  postiz:
    environment:
      YOUR_ENV_VAR: "value"
      YOUR_OTHER_ENV_VAR: "value"

Option 2: Using a .env file

You can use a .env file to set the variables. docker-compose.yml:
services:
  postiz:
    env_file:
      - .env
.env:
YOUR_ENV_VAR=value
YOUR_OTHER_ENV_VAR=value

Option 3: Combine both

You can also use both! docker-compose.yml:
services:
  postiz:
    environment:
      YOUR_ENV_VAR: "value"
    env_file:
      - .env
.env:
YOUR_OTHER_ENV_VAR=value
When using an .env file, you will need to transfer all environment variables from the docker-compose.yml file to the .env file. An .env file will override any variables set in the .yml file. Using an .env file for the DB / Redis won’t be necessary.