How to Solve a Limited Stack in Portainer

This post tells the story of an annoying problem that has been bugging me for some time! Fortunately, I finally managed to find a solution! 🥳

2 min read
How to Solve a Limited Stack in Portainer
Photo by Pixabay from Pexels.

Since recreating my infrastructure (the one currently running this website), I noticed that the stacks I created using the Portainer HTTP API were now "limited".

This stack was created outside of Portainer. Control over this stack is limited.
A screenshot of Portainer 2.13.1 showing several limited stacks.

There are a couple of things you can't do with a limited stack:

  • View and edit the docker-compose.yml file that was used to create the stack
  • View and edit environment variables
  • Remove services that are no longer referenced (pruning)

These are some features that are particularly useful when trying to debug some services... As I haven't had much time to try to find the causes of this malfunction, I kept them for a while until today, because I finally took some time to fix this problem. 💪

Research

If you search the internet for the same error message, you may come across this Reddit post.

A user said he solved the error by matching the stack name with the container name, but I assumed that was not my case because I had no matching names and that was working before. 😕

Another user pointed to another Reddit post, where the user's situation was more similar to mine. The author finally managed to fix the problem by adding a new deploy label to his docker-compose.yml file.

deploy:
  labels:
    io.portainer.accesscontrol.teams: "YOUR_TEAM_HERE"
 

Unfortunately, that didn't work for me. I searched the internet for the label and I found this official Portainer documentation on the subject. It said:

Any resources deployed to Docker or Docker Swarm outside of Portainer will be marked as external and you will have limited control over these resources. By default, these resources will have administrator-only access, but you can enable access control using these labels (examples used, swap out for your own parameters).

It started to get interesting! I tried all three labels available, but I still had the same problem! Damn! 😩

It wouldn't have made sense either, because my Portainer users are all administrators! So they should have access to all stacks, right? 😦

Back to square one! What may have changed recently that could explain my new issue? Maybe it was caused by my new DigitalOcean droplet (referral link)? 🤔

Solution

After a while, I came across a post somewhere that said that a limited stack could be caused by deploying a stack with the wrong Swarm ID. This makes sense because a fresh install of Docker would generate a new Swarm ID!

docker info | grep "ClusterID"
#  ClusterID: 4hjo8qa2o7cwbkhq97807qq7c
The command to retrieve the Swarm ID which should be used when creating a new stack with the Portainer HTTP API.

I updated my environment variable, called the Portainer API to create a new stack and my problem was solved! At least for new stacks, because the problem persisted for existing stacks! Even after deleting and recreating them! 😰

I finally managed to find a drastic solution: completely reinstall Docker and Portainer! But this tale will be in another article! 😉

Hope this post will help you troubleshoot the limited stacks in your Portainer instance! Good luck! 🤞