Can docker-compose / dockerfile access host env vars at build time?

Is it possible for a dockerfile / docker compose file to access the host env vars at build time when running docker-compose build app or do you have to manually pass them into the build command?

>Solution :

Environment variables from the host that you want to use at build time would need to be passed into the build command with the --build-arg flag described here.

Leave a Reply