agent: Unable to retrieve local agent IP address with agent 1.5.0
After updating to agent 1.5.0 I only get error messages:
portainer_agent_1 | 2019/10/11 06:40:19 [ERROR] [main,docker] [message: Unable to retrieve local agent IP address] [error: unable to retrieve the address on which the agent can advertise. Check your network settings]
I am running agent from docker-compose using the following docker-compose.yml
:
version: '2.3'
services:
portainer_agent:
image: "portainer/agent:1.5.0"
ports:
- "9001:9001"
userns_mode: "host"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /mnt/docker/volumes:/var/lib/docker/volumes
- ${MY_VOLUME_PATH}/admin_portainer_agent/:/data
restart: "${RESTART:-unless-stopped}"
System environment:
sven@fangorn:~$ uname -a
Linux fangorn 5.0.0-31-generic #33~18.04.1-Ubuntu SMP Tue Oct 1 10:20:39 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
sven@fangorn:~$ docker version
Client: Docker Engine - Community
Version: 19.03.3
API version: 1.40
Go version: go1.12.10
Git commit: a872fc2f86
Built: Tue Oct 8 00:59:59 2019
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.3
API version: 1.40 (minimum version 1.12)
Go version: go1.12.10
Git commit: a872fc2f86
Built: Tue Oct 8 00:58:31 2019
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.2.6
GitCommit: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc:
Version: 1.0.0-rc8
GitCommit: 425e105d5a03fabd737a126ad93d62a9eeede87f
docker-init:
Version: 0.18.0
GitCommit: fec3683
sven@fangorn:~$ docker-compose version
docker-compose version 1.24.1, build 4667896b
docker-py version: 3.7.3
CPython version: 3.6.8
OpenSSL version: OpenSSL 1.1.0j 20 Nov 2018
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 4
- Comments: 30 (7 by maintainers)
I had the same issue. I fix this running this command
(In my case, I don’t need swarm)
Please reopen. The same issue with
portainer/agent:2.11.1
Same thing happens with
portainer/agent:2.16.2
However, I’ve found solution; adding the env var
AGENT_CLUSTER_ADDR: localhost
solved it for me, (single node swarm). Only found it after switching to the dev image and finding logs that it was missingIt isn’t.
I have tried the 1.5.1 version, however, unfortunately the bug is still present. The same error is still being thrown.
I just found out that the Agent needs to be able to find a Docker container with an ID that matches its hostname. So if you nuke and recreate the container, be sure not to keep the hostname the same when Docker gives the container a new ID.
@nemchik indeed we’ll investigate that one.
EDIT: updated, should be fixed.
Same problem here, 1.5 just produces an error whereas 1.4 works perfectly fine. I have also tried directly running the command produced by the Web UI:
(Note: I’ve censored the edge ID)
I believe the problem is related to this line, in particular
networkInspect.Scope != "swarm"
seems to assume that the container is running inside a docker swarm.