New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When creating a stack, the env file is not found by absolute path. #4600
Comments
Dont know if you got further with this but portainer is looking for that path inside its own container and not in the host system |
Just tried it again and it works now. My bad. |
You need to specifically mount the .env file in your stack, not just place it in a mounted volume. |
Do you mean mount into the portainer container - if so to where. I cannot find any documentation about this. |
Thank you, I am now also aware of that. However, this seems to me to be very cumbersome. Since it has been tracked as a bug, it doesn't seem to be intended that way either. |
You can find information about it here: https://docs.docker.com/compose/environment-variables/#the-env-file Here is an example docker-compose.yml:
|
Could be related to #4813 |
How exactly do you do that? And have you confirmed your method works?
How does that help with the problem being experienced in Portainer? That information only seems to be pertinent to using In a stack, the |
@yannduran can you please try something similar to this example: #5199 (comment) |
@yannduran I found that if I mount a directory into the portainer instance (ie. Note the For context, I have them in the same location on my physical box, but mainly for my own piece of mind/previous implementations. YMMV :) It took me ages of trial and error, but hopefully that'll help! |
Closing as a duplicate of #6390 |
Bug description
When creating a stack, the env file is not found by absolute path.
Expected behavior
When I specify an Env file by absolute path, I expect the file to be read and the values to be set as environment variables in the container.
Portainer Logs
Steps to reproduce the issue:
The following folder structure is on my server:
├── invoice
│ ├── docker-compose.yml
│ └── secrets
│ ├── database.env.dist
│ └── invoice.env.dist
├── nextcloud
├── docker-compose.yml
├── secrets
│ ├── database.env
│ ├── database.env.dist
│ ├── nextcloud.env
│ └── nextcloud.env.dist
└── volumes
A snippet of a docker-compose.yml file shows how I set my paths to the secrets but also to the volumes:
Now to start a stack, I copy the Docker-compse.yml file into the web editor of Portainer. Thereby I set the variable SERVICE_DIR to the corresponding folder by the options the UI gives me.
After clicking on "Deploy the Stack" a red pop up appears in the upper right corner which tells me that the path was not found. Exact wording: "Deployment error
open /home/giom/repos/itmsio/nextcloud/secrets/nextcloud.env: no such file or directory".
However, the path is correct. It should also be mentioned that this method works for volumes and that a start via the naked "docker-compse up" command also works.
Am I missing something here?
Technical details:
"docker-compose up -d" with following docker-compose.yml file:
The text was updated successfully, but these errors were encountered: