- 最新
- 最多得票
- 最多評論
I was having the same issue as you, but using the absolute path /opt/elasticbeanstalk/deployment/env.list
does work for me. Here's my docker-compose.yml:
version: '3.8'
services:
beanstalk-example-dotnet-api:
image: "xxxxxxxxxx.dkr.ecr.us-west-2.amazonaws.com/example-dotnet-api:latest"
ports:
- "80:80"
env_file:
- /opt/elasticbeanstalk/deployment/env.list
A big issue, however, is that when I update the EB environment variables, the env.list
file does not get updated to reflect the updated environment variables values. From what I can tell, I need to rebuild the EB environment to get an updated env.list
file. This is definitely far from ideal.
Hello,
From your question it seems that the Beanstalk is unable to find the .env file in your application bundle. The document specified mentions it is a must to follow one or both of these configuration approaches.
-
Add the .env file generated by Elastic Beanstalk to the env_file configuration option in the docker- compose.yml file.
-
Directly define the environment variables in the docker-compose.yml file.
However I can see that you have you have chosen to follow the first approach. In that case I would refer to please check the file where it has been placed as the file ".env" must be placed in the same directory from where you are calling the "docker-compose.yml" file. This issue mainly occurs due to ".env" file. not being recognised/found as you are including a .env file in your application bundle, hence, not allowing Elastic Beanstalk to generate an ".env" file. Please note to be careful to not leave spaces between the equal sign (=) and the value assigned to your variable in order to prevent spaces from being added to the string. This can also result in issues while creating the environment.
I would suggest you to directly define the environment variables in the "docker-compose.yml file" as mentioned in the Second approach. Please refer to the following document for any help in performing the above mentioned task of defining environment variables.
相關內容
- AWS 官方已更新 1 年前
- AWS 官方已更新 1 年前
- AWS 官方已更新 2 年前
- AWS 官方已更新 1 年前
So, what should I put into docker-compose.yaml to point to ".env file generated by Elastic Beanstalk"? Where does beanstalk generate .env file? The problem is that beanstalk runs "Running command /bin/sh -c docker-compose -f /opt/elasticbeanstalk/deployment/app_source_bundle config -q" before generating environment file.
which fails with "Couldn't find env file: /opt/elasticbeanstalk/deployment/.env and then proceeds "Executing instruction: Generate environment file", which does not generate .env file, but does generate /opt/elasticbeanstalk/deployment/env.list.
docker-compose config fails because environment file is not generated yet and because of that failure the file is not recognized as docker-compose file, so beanstalk tries to use it as Dockerfile and fails. It looks like a bug and there is no way to use docker-compose with the environment file generated by Beanstalk.