# Environment variable using docker-compose is always null

**URL:** <https://forum.elixirforum.com/t/environment-variable-using-docker-compose-is-always-null/41073>\
**Category:** Questions\
**Tags:** docker, docker-compose\
**Created:** [July 16, 2021, 1:10am UTC](https://forum.elixirforum.com/t/environment-variable-using-docker-compose-is-always-null/41073 "2021-07-16T01:10:45Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![CAIOHOBORGHI](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/caiohoborghi/32/20862_2.png) [@CAIOHOBORGHI](https://forum.elixirforum.com/u/CAIOHOBORGHI)\
**Post date:** [July 16, 2021, 12:32pm UTC](https://forum.elixirforum.com/t/environment-variable-using-docker-compose-is-always-null/41073/7 "2021-07-16T12:32:56Z")

</div>

Really weird thing is happening… With docker run -e […ENVS] it does work perfectly, but using docker-compose it doesn’t.

I attached to the container after started with docker compose and executed

```elixir
echo $MY_VAR

```

in the shell and it printed with success, but for some reason when running with docker-compose and trying to System.get\_env(“MY\_VAR”) it’s null

---

_[View the full topic](https://forum.elixirforum.com/t/environment-variable-using-docker-compose-is-always-null/41073)._
