docker / libcompose

*Unmaintained/Deprecated* An experimental go library providing Compose-like functionality
https://godoc.org/github.com/docker/libcompose
Apache License 2.0
585 stars 191 forks source link

external default network specification not being used #484

Open timoreimann opened 7 years ago

timoreimann commented 7 years ago

I'm trying to use a compose manifest where an external default network is being defined. However, it seems like the configuration isn't being honored.

To illustrate my problem, I put together an example repo (note the extra branch I have created for this purpose). The external network is defined here. Starting that compose file with docker-compose like

docker-compose -f simple.yml up

and inspecting the curl (client) container, I see the network being in use:

$ docker inspect libcomposetest_client_1 | jq '.[0].NetworkSettings.Networks'
{
  "ext_network": {
    "IPAMConfig": null,
    "Links": null,
    "Aliases": [
      "client",
      "ef167dd59b6e"
    ],
    "NetworkID": "b7f41ea27a92dda4c06954e05db6b77a1c9928049947f478a9b9da9fd832068a",
    "EndpointID": "",
    "Gateway": "",
    "IPAddress": "",
    "IPPrefixLen": 0,
    "IPv6Gateway": "",
    "GlobalIPv6Address": "",
    "GlobalIPv6PrefixLen": 0,
    "MacAddress": "",
    "DriverOpts": null
  }
}

Doing the same via libcompose through my example application started with go run main.go -f simple.yml, the default compose network is referenced:

$ docker inspect dockercomposetestsimple_client_1 | jq '.[0].NetworkSettings.Networks'
{
  "dockercomposetestsimple_default": {
    "IPAMConfig": null,
    "Links": null,
    "Aliases": [
      "client",
      "73f02e7f701f"
    ],
    "NetworkID": "70a1649c8835f333569837e489d61eccfa34029c3f7293604299ec942ee07e3d",
    "EndpointID": "",
    "Gateway": "",
    "IPAddress": "",
    "IPPrefixLen": 0,
    "IPv6Gateway": "",
    "GlobalIPv6Address": "",
    "GlobalIPv6PrefixLen": 0,
    "MacAddress": "",
    "DriverOpts": null
  }
}

I have also tried to tweak some settings during project creation, but to no avail.

Happy to provide more details if needed.

Thanks :)

/cc @vdemeester