question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

docker containers connected to a network when run won't show up in network_object.containers field

See original GitHub issue

when running a container with

client.containers.run(.....,
                                 network=net1,
                                 ......)

the container ends up connected to the network, but when calling net1.containers on the network object, it returns an empty list ([]) When re-getting the network object with client.networks.get(net1_name), the container shows up.

to reproduce this bug:

  1. create a network object with client.networks.create
  2. run a container with client.containers.run, with parameter network = (the name of the net you created)
  3. check network_object.containers field and see it’s empty
  4. do client.networks.get(net1_name) to re-get the object and see that now the container is present in checked this issue with two different hosts with different docker versions, both reproduced the bug.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
shin-commented, Mar 14, 2019

The list endpoint returns a shortened representation of the Network object, omitting the list of connected containers among other things. You can also use the greedy parameter to load the full data, eg

[n.containers for n in client.networks.list(greedy=True)]
1reaction
shin-commented, Jan 30, 2019

how come this bug is not even looked at?

Maintainers have lives too. But also, it helps to include as much information as possible when reporting an issue.

In this particular case, this is not a bug; you simply need to call reload() on the network object to see the updated list of containers.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't connect to other containers inside docker network
I have a few containerized projects I would like to talk to each other into a network called 'dev_network'. I would expect to...
Read more >
Can't connect to other containers inside docker network
I found a way to do what I want, but it doesn't seem to be configurable via docker-compose.yml. I have to start the...
Read more >
A beginner's guide to networking in Docker | by Uday Hiwarale
Now that we have a running container attached to the bridge network, we should be able to see the container in the Containers...
Read more >
4 Reasons Why Your Docker Containers Can't Talk to Each ...
Avoid wasted hours spent on debugging container networking issues by trying ... Attach a running container to a network docker network connect [network] ......
Read more >
raspberry pi mesh network batman
We used 7 Raspberry Pi's running the Raspbian OS via the Pi…. Multiple devices can be connected in a mesh using the BATMAN...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found