Dokploy / dokploy

Open Source Alternative to Vercel, Netlify and Heroku.
https://dokploy.com/
Other
9.31k stars 459 forks source link

Compose service ignores environment variables #726

Closed prepin closed 2 days ago

prepin commented 3 days ago

To Reproduce

  1. Create a new compose service
  2. Set a git repository (e.g., https://github.com/dockersamples/compose-dev-env)
  3. Set environment variables on Environment tab:
    FOO=BAR
    HELLO=WORLD
  4. Perform deploy
  5. Click "Open Terminal" and run env command

Current vs. Expected behavior

Current Behavior:

Expected Behavior:

Provide environment information

* OS: Linux Mint 22 x86_64 (this is home server)
* Dokploy version: 0.12.0

Which area(s) are affected? (Select all that apply)

Docker Compose

Additional context

Siumauricio commented 2 days ago

Everything seems to be fine, it's simple, if you don't use the environment variable or you are not making a reference in your compose file, will not use it.

prepin commented 2 days ago

Thank you. I figured out what the issue was. I needed to explicitly include the env_file or environment section in the docker-compose.yml file to ensure the environment variables were picked up. Also, the env_file section must explicitly reference the file named .env, and it should be located in the root directory.

Everything works now, thanks again!