portainer: Home not showing containers running in Docker Swarm

Bug description On Portainer CE 2.15.1, on the Home screen it does not show the number of containers running in My Docker Swarm. The number is just “0 containers”. On the Dashboard of the Swarm, it is ok. For standalone Docker there is no problems.

2

3

Expected behavior I would expect Portainer to show the actual number of containers running in the Swarm.

Portainer Logs In the Portainer server, this is logged every 5 minutes:

time="2022-10-27T07:57:25Z" level=info msg="2022/10/27 07:57:25 [WARN] [docker,snapshot] [message: unable to snapshot containers] [environment: Swarm] [err: Error: No such container: f5a9f3aedf4cf127791b4405abf39c552622bab7ec541aefd9f70343f3e6a510]"

Steps to reproduce the issue:

Add Docker Swarm environment to Portainer. Open Portainer Home screen.

Technical details:

  • Portainer version: CE 2.15.1
  • Docker version (managed by Portainer): 20.10.18
  • Kubernetes version (managed by Portainer): N/A
  • Platform (windows/linux): Docker Swarm is Ubuntu 20.04 LTS. Portainer server is running on Synology DSM 7.1 docker.
  • Command used to start Portainer (docker run -p 9443:9443 portainer/portainer): Compose stack
portainer:
    restart: always
    image: portainer/portainer-ce
    container_name: portainer-ce
    networks:
      - slimnasproxy_default
    ports:
      - "9000:9000/tcp"
      - "8000:8000/tcp"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /volume2/docker/volumes/portainer_data:/data
    environment:
      TZ: "Europe/Copenhagen"
  • Browser: Brave, Firefox.
  • Use Case (delete as appropriate): Using Portainer at Home
  • Have you reviewed our technical documentation and knowledge base? Yes.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 3
  • Comments: 17 (2 by maintainers)

Most upvoted comments

Update:

I wanted to follow up on this request. The issue is going to be resolved in 2.18.

Thanks!

I have logged an internal issue for the unable to snapshot containers | error="Error: No such container: logging messages. Product is currently reviewing. I do not yet have a release or timeline. I will update as I learn more.

Thanks!

Update:

I wanted to follow up on this request. The issue is going to be resolved in 2.18.

Thanks!

I have upgraded to 2.18.1 and can confirmed that the issue has been fixed.

For traceability, the fix was linked to this issue: https://github.com/portainer/portainer/issues/8695

Hi @tamarahenson

I’m adding this comment just to make you aware of the fact that this bug has an effect also on the docker api endpoints queried through portainer.

Indeed, a DELETE request like

{{baseUrl}}/endpoints/{{id}}/docker/containers/{{container_id}}?force=true

returns a 404 not found with the message “No such container: …” even though the container is present in the endpoint.

Also the portainer endpoint

{{baseUrl}}/endpoints

returns null as value of key Containers in DockerSnapshotRaw object

"ServiceCount": 20,
"StackCount": 12,
"DockerSnapshotRaw": {
    "Containers": null,
    "Volumes": {
        "Volumes": [

@hhromic

Thank you for reviewing my testing. I was using (1) Manager Swarm Cluster. I have deployed a (1) Manager (2) Worker Swarm Cluster and am able to reproduce the issue. The issue appears in 2.15 as @MadsBen had initially reported, as well as 2.16 and 2.17. I am logging an internal request.

Screen Shot 2023-02-27 at 1 49 36 PM

Thanks!

Issue is still present in Portainer 2.17.0 and Docker 23.0.0.

@gbozzetti

Thank you for the additional information. I am currently investigating. I will update as I learn more.

Thanks!

@tamarahenson have you tried with more than one node in the Swarm cluster? Me and other reporters are seeing this issue with 3 or more nodes in the swarm clusters.