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
Unable to retrieve local agent IP address with agent 1.5.0 #95
Comments
Same problem here, 1.5 just produces an error whereas 1.4 works perfectly fine.
(Note: I've censored the edge ID) I believe the problem is related to this line, in particular |
Same problem on linux/arm. |
I have tried the 1.5.1 version, however, unfortunately the bug is still present. The same error is still being thrown. |
@UniverseXXX please share the logs of the Portainer agent with us and give us more information about the platform where the agent is running. |
Ubuntu 19.10 x86_64 /Linux ubuntu 5.3.0-19-generic/
|
@UniverseXXX can you start the agent with debug logs enabled? Add the following environment variable to your stack file:
Also, can you share the ENTIRE logs with us? Thanks |
@deviantony Here is the log:
and perhaps, it would be useful, here is how network is being declared:
Thanks. |
@UniverseXXX thanks. When I meant the ENTIRE logs, entire logs would be nice to have. Just to ensure that you are correctly running the latest version and that allow us to avoid making assumptions.
Anyway, I assume that you're running the agent inside a Swarm over a macvlan network? |
@deviantony Thanks for the reply. Yes, it's running over a macvlan network. |
Happens to me as well. I'm trying to use the Edge agent as an alternative to connecting directly to the Docker agent, which would require having to maintain an internal TLS PKI. The node is a standalone AWS EC2 instance with Docker installed. I'm running the command as given by the Web UI, edited only to disable autorestart (because the Agent exits anyway) and enable debug logging:
The node only has the default Docker networks:
Here's the log output from Portainer agent:
|
Actually, scratch that: It appears I had already pulled the Sorry for the noise. |
I'm having the issue. Here's my compose: version: '3.4'
services:
portaineragent:
container_name: portaineragent
environment:
CAP_HOST_MANAGEMENT: '1'
LOG_LEVEL: debug
TZ: America/Chicago
image: portainer/agent
logging:
driver: json-file
options:
max-file: '10'
max-size: 200k
ports:
- published: 9001
target: 9001
restart: unless-stopped
volumes:
- /etc/localtime:/etc/localtime:ro
- /:/host:rw
- /home/gibbs/.config/appdata/shared:/shared:rw
- /var/lib/docker/volumes:/var/lib/docker/volumes:rw
- /var/run/docker.sock:/var/run/docker.sock:rw Here's the output of
Here is the output of [
{
"Id": "fd319d85d22a8f72a8ab2cbc7a11632dab15c36b6e9e9a54bd0396510e92cad3",
"Created": "2019-10-28T17:03:03.485344308Z",
"Path": "./agent",
"Args": [],
"State": {
"Status": "exited",
"Running": false,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 0,
"ExitCode": 1,
"Error": "",
"StartedAt": "2019-10-28T17:34:31.10567086Z",
"FinishedAt": "2019-10-28T17:34:31.175511934Z"
},
"Image": "sha256:601a011ddd8b56a001dc5795aa39491d2129d323b19d649d7b75bacd903bfb3f",
"ResolvConfPath": "/var/lib/docker/containers/fd319d85d22a8f72a8ab2cbc7a11632dab15c36b6e9e9a54bd0396510e92cad3/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/fd319d85d22a8f72a8ab2cbc7a11632dab15c36b6e9e9a54bd0396510e92cad3/hostname",
"HostsPath": "/var/lib/docker/containers/fd319d85d22a8f72a8ab2cbc7a11632dab15c36b6e9e9a54bd0396510e92cad3/hosts",
"LogPath": "/var/lib/docker/containers/fd319d85d22a8f72a8ab2cbc7a11632dab15c36b6e9e9a54bd0396510e92cad3/fd319d85d22a8f72a8ab2cbc7a11632dab15c36b6e9e9a54bd0396510e92cad3-json.log",
"Name": "/portaineragent",
"RestartCount": 40,
"Driver": "aufs",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "docker-default",
"ExecIDs": null,
"HostConfig": {
"Binds": [
"/:/host:rw",
"/etc/localtime:/etc/localtime:ro",
"/var/run/docker.sock:/var/run/docker.sock:rw",
"/var/lib/docker/volumes:/var/lib/docker/volumes:rw",
"/home/gibbs/.config/appdata/shared:/shared:rw"
],
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {
"max-file": "10",
"max-size": "200k"
}
},
"NetworkMode": "compose_default",
"PortBindings": {
"9001/tcp": [
{
"HostIp": "",
"HostPort": "9001"
}
]
},
"RestartPolicy": {
"Name": "unless-stopped",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": [],
"CapAdd": null,
"CapDrop": null,
"Capabilities": null,
"Dns": null,
"DnsOptions": null,
"DnsSearch": null,
"ExtraHosts": null,
"GroupAdd": null,
"IpcMode": "shareable",
"Cgroup": "",
"Links": null,
"OomScoreAdj": 0,
"PidMode": "",
"Privileged": false,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"SecurityOpt": null,
"UTSMode": "",
"UsernsMode": "",
"ShmSize": 67108864,
"Runtime": "runc",
"ConsoleSize": [
0,
0
],
"Isolation": "",
"CpuShares": 0,
"Memory": 0,
"NanoCpus": 0,
"CgroupParent": "",
"BlkioWeight": 0,
"BlkioWeightDevice": null,
"BlkioDeviceReadBps": null,
"BlkioDeviceWriteBps": null,
"BlkioDeviceReadIOps": null,
"BlkioDeviceWriteIOps": null,
"CpuPeriod": 0,
"CpuQuota": 0,
"CpuRealtimePeriod": 0,
"CpuRealtimeRuntime": 0,
"CpusetCpus": "",
"CpusetMems": "",
"Devices": null,
"DeviceCgroupRules": null,
"DeviceRequests": null,
"KernelMemory": 0,
"KernelMemoryTCP": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": null,
"OomKillDisable": false,
"PidsLimit": null,
"Ulimits": null,
"CpuCount": 0,
"CpuPercent": 0,
"IOMaximumIOps": 0,
"IOMaximumBandwidth": 0,
"MaskedPaths": [
"/proc/asound",
"/proc/acpi",
"/proc/kcore",
"/proc/keys",
"/proc/latency_stats",
"/proc/timer_list",
"/proc/timer_stats",
"/proc/sched_debug",
"/proc/scsi",
"/sys/firmware"
],
"ReadonlyPaths": [
"/proc/bus",
"/proc/fs",
"/proc/irq",
"/proc/sys",
"/proc/sysrq-trigger"
]
},
"GraphDriver": {
"Data": null,
"Name": "aufs"
},
"Mounts": [
{
"Type": "bind",
"Source": "/etc/localtime",
"Destination": "/etc/localtime",
"Mode": "ro",
"RW": false,
"Propagation": "rprivate"
},
{
"Type": "bind",
"Source": "/var/run/docker.sock",
"Destination": "/var/run/docker.sock",
"Mode": "rw",
"RW": true,
"Propagation": "rprivate"
},
{
"Type": "bind",
"Source": "/var/lib/docker/volumes",
"Destination": "/var/lib/docker/volumes",
"Mode": "rw",
"RW": true,
"Propagation": "rslave"
},
{
"Type": "bind",
"Source": "/home/gibbs/.config/appdata/shared",
"Destination": "/shared",
"Mode": "rw",
"RW": true,
"Propagation": "rprivate"
},
{
"Type": "bind",
"Source": "/",
"Destination": "/host",
"Mode": "rw",
"RW": true,
"Propagation": "rslave"
}
],
"Config": {
"Hostname": "fd319d85d22a",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"9001/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"CAP_HOST_MANAGEMENT=1",
"TZ=America/Chicago",
"LOG_LEVEL=debug",
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Cmd": null,
"Image": "portainer/agent",
"Volumes": {
"/etc/localtime": {},
"/host": {},
"/shared": {},
"/var/lib/docker/volumes": {},
"/var/run/docker.sock": {}
},
"WorkingDir": "/app",
"Entrypoint": [
"./agent"
],
"OnBuild": null,
"Labels": {
"com.docker.compose.config-hash": "e64ad14a7ad1b2cbd0cf40de106b5eaed9a0c7b454ceef03a484e83381fc5a98",
"com.docker.compose.container-number": "1",
"com.docker.compose.oneoff": "False",
"com.docker.compose.project": "compose",
"com.docker.compose.service": "portaineragent",
"com.docker.compose.version": "1.24.0"
}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "5dfdd94c74e31bf74538c653a9b85afafb507b89b388a62c5a2be9c9aede8d05",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {},
"SandboxKey": "/var/run/docker/netns/5dfdd94c74e3",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "",
"Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"MacAddress": "",
"Networks": {
"compose_default": {
"IPAMConfig": null,
"Links": null,
"Aliases": [
"fd319d85d22a",
"portaineragent"
],
"NetworkID": "217a6d2fd8cac38404c4da14da1014f819b26929ba3c6fbe27b8345f0eba40c1",
"EndpointID": "",
"Gateway": "",
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "",
"DriverOpts": null
}
}
}
}
]
Here's my
(these same 3 lines just repeat infinitely) The edit: added docker inspect |
@nemchik please pull the latest version of the agent. |
@UniverseXXX interesting, we did not test this use case. I think that the latest version of the agent is not compatible with macvlan in a Swarm as the macvlan network is not tagged as a swarm scoped. EDIT: I'll re-open the issue and rename it to track this evolution. |
I stopped and rm'd the container, and pruned the image, and then ran compose again (same compose I posted above) which showed the latest image was pulled. It's still giving me the same error in the docker logs. I have tried some Here is the output of [
{
"Id": "sha256:601a011ddd8b56a001dc5795aa39491d2129d323b19d649d7b75bacd903bfb3f",
"RepoTags": [
"portainer/agent:latest"
],
"RepoDigests": [
"portainer/agent@sha256:06f1244d67c258218eb577db761b269e95b9f2c877d9b3b9022aca3d0c4ba306"
],
"Parent": "",
"Comment": "",
"Created": "2019-10-10T22:08:07.931357616Z",
"Container": "046241ac4ea49c372141a615e49096e29bdd65aee2b798e5098a7542ff7ce145",
"ContainerConfig": {
"Hostname": "046241ac4ea4",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Cmd": [
"/bin/sh",
"-c",
"#(nop) ",
"ENTRYPOINT [\"./agent\"]"
],
"Image": "sha256:7e8549cf7afcd22a8ec3cc01abb24b19ef35a26726443154d22ecccc99fa7dab",
"Volumes": null,
"WorkingDir": "/app",
"Entrypoint": [
"./agent"
],
"OnBuild": null,
"Labels": {}
},
"DockerVersion": "19.03.2",
"Author": "",
"Config": {
"Hostname": "",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Cmd": null,
"Image": "sha256:7e8549cf7afcd22a8ec3cc01abb24b19ef35a26726443154d22ecccc99fa7dab",
"Volumes": null,
"WorkingDir": "/app",
"Entrypoint": [
"./agent"
],
"OnBuild": null,
"Labels": null
},
"Architecture": "amd64",
"Os": "linux",
"Size": 13918342,
"VirtualSize": 13918342,
"GraphDriver": {
"Data": null,
"Name": "aufs"
},
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:dd4969f97241b9aefe2a70f560ce399ee9fa0354301c9aef841082ad52161ec5",
"sha256:ddb8df5a6197bb07a99f4d21fbd95e9dc8a47b51277bd7c6bdc9fb07aaf149b8",
"sha256:4b3e31b7e84051ca299e0a81bb2cceb167c11eedec073cfd5c937a20f54997b9",
"sha256:809d262ed716f79a8b65b7910ad875152cae32525ede39756087a4a0ca716fe3"
]
},
"Metadata": {
"LastTagTime": "0001-01-01T00:00:00Z"
}
}
]
[
{
"Id": "sha256:601a011ddd8b56a001dc5795aa39491d2129d323b19d649d7b75bacd903bfb3f",
"RepoTags": [
"portainer/agent:latest"
],
"RepoDigests": [
"portainer/agent@sha256:06f1244d67c258218eb577db761b269e95b9f2c877d9b3b9022aca3d0c4ba306"
],
"Parent": "",
"Comment": "",
"Created": "2019-10-10T22:08:07.931357616Z",
"Container": "046241ac4ea49c372141a615e49096e29bdd65aee2b798e5098a7542ff7ce145",
"ContainerConfig": {
"Hostname": "046241ac4ea4",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Cmd": [
"/bin/sh",
"-c",
"#(nop) ",
"ENTRYPOINT [\"./agent\"]"
],
"Image": "sha256:7e8549cf7afcd22a8ec3cc01abb24b19ef35a26726443154d22ecccc99fa7dab",
"Volumes": null,
"WorkingDir": "/app",
"Entrypoint": [
"./agent"
],
"OnBuild": null,
"Labels": {}
},
"DockerVersion": "19.03.2",
"Author": "",
"Config": {
"Hostname": "",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Cmd": null,
"Image": "sha256:7e8549cf7afcd22a8ec3cc01abb24b19ef35a26726443154d22ecccc99fa7dab",
"Volumes": null,
"WorkingDir": "/app",
"Entrypoint": [
"./agent"
],
"OnBuild": null,
"Labels": null
},
"Architecture": "amd64",
"Os": "linux",
"Size": 13918342,
"VirtualSize": 13918342,
"GraphDriver": {
"Data": null,
"Name": "aufs"
},
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:dd4969f97241b9aefe2a70f560ce399ee9fa0354301c9aef841082ad52161ec5",
"sha256:ddb8df5a6197bb07a99f4d21fbd95e9dc8a47b51277bd7c6bdc9fb07aaf149b8",
"sha256:4b3e31b7e84051ca299e0a81bb2cceb167c11eedec073cfd5c937a20f54997b9",
"sha256:809d262ed716f79a8b65b7910ad875152cae32525ede39756087a4a0ca716fe3"
]
},
"Metadata": {
"LastTagTime": "0001-01-01T00:00:00Z"
}
}
] Is it possible that there's something wrong with the |
Just for extra info i pulled
However |
@nemchik indeed we'll investigate that one. EDIT: updated, should be fixed. |
Seems resolved for me. Thanks! |
Just a bit of re-organisation for this issue. Sorry @UniverseXXX please re-open a new issue regarding the support of Macvlan if you're still interested in seeing this. |
Using version 2.0.0, 1.5.1 or latest same issue here. `2021/01/12 14:31:32 [INFO] [main] [message: Agent running on Docker platform] 2021/01/12 14:31:32 [ERROR] [main,docker] [message: Unable to retrieve local agent IP address] [error: Error: No such container: da585a09ce2a] 2021/01/12 14:31:58 [WARN] [os,options] [message: the CAP_HOST_MANAGEMENT environment variable is deprecated and will likely be removed in a future version of Portainer agent]` |
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. |
I have this same problem, I've got a feeling that it's to do with the fact that my server has a Wi-Fi connection and Ethernet connection both with different IP addresses, is there a way to get the agent to just bind to one of the IP addresses. eg: |
I had the same issue. I fix this running this command sudo docker swarm leave --force (In my case, I don't need swarm) |
+1 |
It isn't. |
I've been running Agent in swarm mode using the 2.7.0 image (not sure which Agent version that corresponds to) on Ubuntu 20 with no problems whatsoever, then suddenly it started spitting these messages in the log. Deleted the container and pulled 2.12.1, but the result is the same. This coincided with the only swarm manager node being updated from Armbian 10 to 11, but I fail to see how that could cause an unchanged worker node to become unable to detect its own IP address. |
Please reopen. |
Same with portainer/agent:2.15.1 |
Same thing happens with However, I've found solution; adding the env var |
That's save my time. |
To expand the @hazdev's answer:
So this |
THANK YOU! |
After updating to agent 1.5.0 I only get error messages:
I am running agent from docker-compose using the following
docker-compose.yml
:System environment:
The text was updated successfully, but these errors were encountered: