How to manage API keys and passwords that should not be published in Rails development using Docker in a separate file.
docker-compose run container name bundle install
By writing env_file in yml, you can set to read the file that manages environment variables.
code:docker-compose.yml web: abridgement env-file: - .env(Describe the file name for which you want to manage environment variables)
I edited docker-compose.yml, so I will build it again.
MAP_API_KEY="Issued API key" PASSWORD="password"
Omitted above <script src="https://maps.googleapis.com/maps/api/js?key=<%=ENV['MAP_API_KEY']%>&callback=initMap" async defer></script>
The important thing here is to write
<% = ENV ['']%> according to the erb template.
Without doing this, I wrote
ENV ['MAP_API_KEY'] and handed it over, and I couldn't display it in view well, and it was stuck for about 2 days.