Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Portainer agents enter restarting state after a few minutes #268

Closed
MCWertGaming opened this issue Mar 9, 2022 · 2 comments
Closed

Portainer agents enter restarting state after a few minutes #268

MCWertGaming opened this issue Mar 9, 2022 · 2 comments

Comments

@MCWertGaming
Copy link

Hello,
I'm facing the issue that when I start a portainer agend, it's starting fine and runs well. I even can connect with my portainer server (CE) normally without any issue. The problem appears after a few hours. Basically the container suddenly has the status restarting as shown below:
image

The logs:

2022/03/09 05:47:13 [INFO] [main] [message: Agent running on Docker platform]
2022/03/09 05:47:13 [ERROR] [main,docker] [message: Unable to retrieve local agent IP address] [error: Error: No such container: e48af7393b76]
2022/03/09 05:48:14 [INFO] [main] [message: Agent running on Docker platform]
2022/03/09 05:48:14 [ERROR] [main,docker] [message: Unable to retrieve local agent IP address] [error: Error: No such container: e48af7393b76]
2022/03/09 05:49:14 [INFO] [main] [message: Agent running on Docker platform]
2022/03/09 05:49:14 [ERROR] [main,docker] [message: Unable to retrieve local agent IP address] [error: Error: No such container: e48af7393b76]

portainer version: 2.11.1 (the one standing in the webui on the lower left)
other version: 20.10.12
image

I'm using the newest docker container and run it using docker compose. There is no problem with the portainer server. The other containers are running fine and the problem occurs on all of my 3 portainer-agent nodes.

The docker compose:

version: "3"

services:
  step-ca:
    image: docker.io/smallstep/step-ca
    container_name: step-ca
    restart: unless-stopped
    ports: 
      - 10.10.11.20:443:443
    volumes:
      - step:/home/step
    labels:
      - com.centurylinklabs.watchtower.enable=true
  watchtower:
    image: docker.io/containrrr/watchtower
    container_name: watchtower
    restart: unless-stopped
    environment:
      - WATCHTOWER_CLEANUP=true
      - NO_COLOR=true
      - WATCHTOWER_POLL_INTERVAL=30
      - WATCHTOWER_LABEL_ENABLE=true
      - WATCHTOWER_ROLLING_RESTART=true
      - WATCHTOWER_TIMEOUT=300s
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
  portainer-agent:
    image: cr.portainer.io/portainer/agent
    container_name: portainer-agent
    restart: unless-stopped
    environment:
      - AGENT_SECRET=${AGENT_SECRET}
    ports:
      - 9001:9001
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /var/lib/docker/volumes:/var/lib/docker/volumes
    labels:
      - com.centurylinklabs.watchtower.enable=true

volumes:
  step:
    external: true

I hope you can give me some assistance in fixing this problem. Thank you really much!

@MCWertGaming
Copy link
Author

Seems like #166 is the same.

@MCWertGaming
Copy link
Author

fixed by adding hostname: portainer-agent to the docker compose. Weird fix, but it works for now. See #166 for future updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant