portainer: Environment Variables not being set for Stacks

Bug description When deploying a new Stack in Portainer, the containers don’t have any variables passed to them but when deployed via docker stack deploy it works perfectly.

Expected behavior Containers to have variables set

Steps to reproduce the issue:

  1. Go to Stacks
  2. Click on Add Stack
  3. Add Environment Variables
  4. Deploy the stack
  5. See error

Technical details:

  • Portainer version: 1.21.0
  • Docker version (managed by Portainer):
  • Platform (windows/linux): Linux
  • Command used to start Portainer (docker run -p 9000:9000 portainer/portainer):
curl -L https://downloads.portainer.io/portainer-agent-stack.yml -o portainer-agent-stack.yml
docker stack deploy --compose-file=portainer-agent-stack.yml portainer
  • Browser: Google Chrome Version 75.0.3770.142 (Official Build) (64-bit)

Additional context This was tested via both putting the compose file in the editor and using a Github repo

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15

Most upvoted comments

@bsquidwrd ok, if you are still having issues I am happy to help debug.

Also @Cinezaster maybe this means there needs to be a clearer UI here. Easiest thing I can think of is a description under the Environment title or a tool-tip such as Define your environment variables here for substitution into your yml file

Hi there @Cinezaster , I have been unable to reproduce this with the exact same Docker, Docker API and Portainer versions as you. Are you doing anything different to me?

Here is how I tested:

  1. Deploy a simple nginx service via stack with an env var set image
  2. Confirm that the env var is set on service and container image

Hi there @pierredavidbelanger, the official Portainer agent stack file has been updated to remove the un-needed environment variables so there should be no issues.