dockerdocker-composeportainer

Portainer server unable to connect with any Portainer agents


I am running Portainer CE on a server that is supposed to be connecting with agents on other servers. The Portainer server and all agents are running in docker containers.

I was able to manage docker containers and stacks with no problems before, but now suddenly I cannot manage any docker containers through agents.

The agents on the various machines are run using docker-compose. The agent YML file is shown below:

version: "3"

services:
  portainer_agent:
    image: portainer/agent:latest
    container_name: portainer_agent
    restart: unless-stopped
    ports:
      - 9001:9001
    volumes:
        - ./var/lib/docker/volumes:/var/lib/docker/volumes
        - /var/run/docker.sock:/var/run/docker.sock

On the Portainer web app's "Environments" page, all the servers are showing docker as being "down". This is occurring despite the fact that if I ssh into the servers and do a "docker ps", I see the containers that I installed on the server!

I attempt to connect to my servers using the "Live Connect" button, but after several minutes I get Error messages saying that the "Environment is unreachable".

I am running my agents on the default port 9001. The port 90-01 is open. and I aam getting no adverse log entries on the agents. The Portainer server for some reason is simply failing to communicate with the agents.

The server and the agents are running Version 2.19.4.

Has anyone else seen this problem??? Can someone provide some information on why Portainer is failing to connect with agents and (more importantly) how to fix this problem?


Solution

  • I did attempt to resolve this problem by restarting the container agents as suggested by Nick above. This did not work.

    I ended up moving my Portainer installation to a machine running Ubuntu. I had been noticing that with updates of my systems that are running CentOS and Almalinux distributions my docker containers have tended to fail in various ways. I had even created containers for applications that I had developed and watched them crash and fail in other ways on Almalinux and CentOS. I am beginning to suspect that support for Docker on these platforms is being reduced in favor of encouraging people to migrate to Podman.

    In any event: I moved my Portainer installation to a system that is running Ubuntu and my connections to Portainer agents immediately worked without problems. My new Portainer installation can even communicate (without problems) with agents that are running on the few systems that I have left that are running CentOS and Almalinux.

    I plan to eventually convert all my systems to using distributions that are not derived from Red Hat distributions. Doing so seems to solve all manner of problems that I have seen running docker containers.