Skip to content

Changing DOMAIN variable in .env file did not make traefik serve the app on that domain #1201

Answered by willhama
yohaoquan asked this question in Questions
Discussion options

You must be logged in to vote

@yohaoquan I might have the answer for you. There seems some misconfiguration within the docker-compose.yml file. Currently it is defined as:

    env_file:
      - .env
    environment:
      - DOMAIN=${DOMAIN}

By priority it takes DOMAIN from your host env variables first and overwrites the one in the .env when you run docker compose up.

Try to execute echo $DOMAIN on your host environment and see whats coming there.

Actually, I am not sure why both are defined in the docker-compose.yml file.

You can remove the following line and it should work fine:

- DOMAIN=${DOMAIN}

@tiangolo why do you declare the environment and the .env file in docker-compose.yml?

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by yohaoquan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
2 participants