Bug description
Since we use GitHub Package Registry instead of DockerHub to host our images, only the manager node can pull the images. We get "No such image: docker.pkg.github.com/..." when it tries to run on a worker node. It seems that the worker nodes don't have the necessary information to pull an image from a custom registry.
Here is how I understood there was a problem:

As you can see, all containers on the worker node are rejected. Only the manager node manages to run the containers.
Here is the error message on the rejected container:

Here is an example on a stack. See how many rejected before it finally launches:

Expected behavior
Normally it should be able to pull the new image, no matter if it's a manager node or a worker node.
Steps to reproduce the issue:
docker login -u GITHUB_USERNAME -p GITHUB_PASSWORD https://docker.pkg.github.com && docker push docker.pkg.github.com/ORG_NAME/REPO_NAME/IMAGE_NAME:TAGTechnical details:
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 portainerSolved the issue. More details:
This bug arises when there are conflicts among images (old cache images etc.). The solution is to clean all unused images from the cluster. You have to connect to one manager server of your cluster.
When connected to the manager server, you can then run the following two commands:
$ docker images -q |xargs docker rmi
This will erase all unused images. Then you also have to go on Portainer, click on your endpoint called primary, then Images. Select all images with the Unused tag, and remove them.