maz
Load env vars with docker-compose env_file, secrets
Hi all, I have an elixir umbrella app that I deploy via docker-compose. I’d like to use env_file directive in my docker-compose.yml for things like guardian keys etc. I have my env vars in a my_app.env file which is referred to in the docker-compose.yml. The vars do not appear to be available at runtime because when I try to generate a JWT with guardian, the phoenix endpoint generates a Bad Request. If I return the hardcoded key, it works OK.
Any recommendations to getting secrets or env vars injected into a running docker elixir app? I also tried docker secrets via the docker-compose file and I can confirm that the umbrella app cannot find the /run/secrets/secret_file path/volume, even though docker builds the image without error. I did notice that /run/secrets doesn’t appear in docker volumes ls but that might not be either here or there.
Most Liked
NobbZ
Docker secrets only work when you are using docker swarm.
And the environment variables should be available but perhaps you are reading them at the wrong time?
Can you tell us more about your build process and how you read from the environment?
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








