If I'm not wrong, it seems like defined with Figaro variables are not available in Docker container.
I have env files to configure Postgresq DB:
POSTGRES_USER=ENV['db_user']
POSTGRES_PASSWORD=ENV['db_password]
POSTGRES_DB=ENV['db_name']
I have application.yml file copied with all the other Rails app files to the container (I could check it with ls in the container shell).
Is it a normal behaviour ?
I also faced this issue when working on a Rails application.
The thing to note here is that for Docker, environment variables are placed in a
.envfile or anenv_file(my_variables.env). Environment files placed in.ymlor.yamlfiles (application.yml) are not often recognized by Docker during runtime. Here's a link to Docker's official documentation that further explains it: The “.env” fileAn example of such environment variables are Database connection strings which are required during the application startup process like:
However, you can still use the Figaro gem for defining variables that are not required during application startup, like:
That's all.
I hope this helps