In my .env
file I have setup the USERNAME:
USERNAME=myuser
When I do a docker compose build, it is unable to resolve the placeholders $USERNAME in the Dockerfile.
My Dockerfile:
FROM busybox:latest as build
ENV USERNAME=$USERNAME
.
.
.
How can I achieve this
2
Answers
I figured out the reason - the .env file must reside in the same folder as docker-compose.yml
Try this:
docker-compose.yml
Dockerfile
.env
If you not use .env file, just remove env_file properties and set env in args.