-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
docker node ps with multiple nodes duplicates entries for the first node specified #4155
Comments
Thanks for reporting! I gave this a quick try, and was able to reproduce this. Had a (brief) glance and the CLI code, and nothing immediately stood out as incorrect on the CLI side :thinking_face: The command defaults to use Lines 36 to 40 in a0756c3
After which it collect tasks for each node (getting the tasklist for each node (filtering the tasks based on node-ID)); Lines 65 to 88 in a0756c3
Some possibilities;
My reproducing was on docker 23.0.2; docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS ENGINE VERSION
yg550ettvsjn6g6t840iaiwgb * swarm-test-01 Ready Active Reachable 23.0.2
2lm9w9kbepgvkzkkeyku40e65 swarm-test-02 Ready Active Leader 23.0.2
hc0pu7ntc7s4uvj4pv7z7pz15 swarm-test-03 Ready Active Reachable 23.0.2
n41b2cijmhifxxvz56vwrs12q swarm-test-04 Ready Active 23.0.2 docker node ps
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
hyrvvroi2ve0 service.1 thajeztah/redacted:latest swarm-test-01 Running Running 5 days ago
n0k48214ocjx \_ service.1 thajeztah/redacted:latest swarm-test-01 Shutdown Failed 5 days ago "task: non-zero exit (2)"
t4aoc5bom8lj jvs.2 thajeztah/redacted2 swarm-test-01 Shutdown Rejected 2 months ago "No such image: thajeztah/reda…"
v5d1wdx5hguk \_ jvs.2 thajeztah/redacted2 swarm-test-01 Shutdown Rejected 2 months ago "No such image: thajeztah/reda…"
wawc9957rrc2 \_ jvs.2 thajeztah/redacted2 swarm-test-01 Shutdown Rejected 2 months ago "No such image: thajeztah/reda…"
root@swarm-test-01:~# docker node ps swarm-test-01 swarm-test-02
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
hyrvvroi2ve0 \_ service.1 thajeztah/redacted:latest swarm-test-01 Running Running 5 days ago
hyrvvroi2ve0 \_ service.1 thajeztah/redacted:latest swarm-test-01 Running Running 5 days ago
n0k48214ocjx \_ service.1 thajeztah/redacted:latest swarm-test-01 Shutdown Failed 5 days ago "task: non-zero exit (2)"
n0k48214ocjx \_ service.1 thajeztah/redacted:latest swarm-test-01 Shutdown Failed 5 days ago "task: non-zero exit (2)"
t4aoc5bom8lj \_ jvs.2 thajeztah/redacted2:latest swarm-test-01 Shutdown Rejected 2 months ago "No such image: thajeztah/reda…"
t4aoc5bom8lj \_ jvs.2 thajeztah/redacted2:latest swarm-test-01 Shutdown Rejected 2 months ago "No such image: thajeztah/reda…"
v5d1wdx5hguk \_ jvs.2 thajeztah/redacted2:latest swarm-test-01 Shutdown Rejected 2 months ago "No such image: thajeztah/reda…"
v5d1wdx5hguk \_ jvs.2 thajeztah/redacted2:latest swarm-test-01 Shutdown Rejected 2 months ago "No such image: thajeztah/reda…"
wawc9957rrc2 \_ jvs.2 thajeztah/redacted2:latest swarm-test-01 Shutdown Rejected 2 months ago "No such image: thajeztah/reda…"
wawc9957rrc2 \_ jvs.2 thajeztah/redacted2:latest swarm-test-01 Shutdown Rejected 2 months ago "No such image: thajeztah/reda…"
pd8ofvb3qy4q jvs.4 thajeztah/redacted2:latest swarm-test-02 Running Running 3 weeks ago
jbszl4zfhoih \_ jvs.4 thajeztah/redacted2:latest swarm-test-02 Shutdown Complete 3 weeks ago
ocj5hoan9wbz \_ jvs.4 thajeztah/redacted2:latest swarm-test-02 Shutdown Failed 6 months ago "No such container: jvs.4.ocj5…"
xpg5cyy30g8i \_ jvs.4 thajeztah/redacted2:latest swarm-test-02 Shutdown Complete 6 months ago |
24.0.6 still has this problem [ where can I vote for this issue :-) ] |
Can I pick up this issue? I have started contributing to open-source projects, and this issue seems to be a good one to start with. I also have a hunch that the problem is with how the filter is built in the for loop! Lines 77 to 78 in ddd4c39
When running the docker node ps command with multiple nodes in the for loop, the filter state retains node-specific data from previous iterations, causing task entries to be duplicated for the first specified node. This occurs because the filter object, being a dictionary type, was reused and modified across iterations, accumulating previous node filters.
I will set up the project, and see if this is the problem! |
Sure, go for it! I don't think anyone has had time to work on this, so go ahead 🤘 |
@thaJeztah I created this PR |
Description
When executing 'docker node ps node1 node2', containers running on node1 will appear in the list twice, while containers for node2 will appear only once.
Switching the order of the nodes 'docker node ps node2 node1' results in the containers on node2 being listed twice.
Running the command when specifying only one node correctly displays each container only once.
Reproduce
Expected behavior
Output should be a list of all containers running in the swarm with a single entry for each container.
docker version
docker info
Additional Info
No response
The text was updated successfully, but these errors were encountered: