Skip to content

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

Open
@R0yco

Description

@R0yco

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions