1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/daemon
Ahmet Alp Balkan 755f8609f6 Add containers’ networks to /containers/json
After addition of multi-host networking in Docker 1.9, Docker Remote
API is still returning only the network specified during creation
of the container in the “List Containers” (`/containers/json`) endpoint:

    ...
    "HostConfig": {
      "NetworkMode": "default"
    },

The list of networks containers are attached to is only available at
Get Container (`/containers/<id>/json`) endpoint.
This does not allow applications utilizing multi-host networking to
be built on top of Docker Remote API.

Therefore I added a simple `"NetworkSettings"` section to the
`/containers/json` endpoint. This is not identical to the NetworkSettings
returned in Get Container (`/containers/<id>/json`) endpoint. It only
contains a single field `"Networks"`, which is essentially the same
value shown in inspect output of a container.

This change adds the following section to the `/containers/json`:

    "NetworkSettings": {
      "Networks": {
        "bridge": {
          "EndpointID": "2cdc4edb1ded3631c81f57966563e...",
          "Gateway": "172.17.0.1",
          "IPAddress": "172.17.0.2",
          "IPPrefixLen": 16,
          "IPv6Gateway": "",
          "GlobalIPv6Address": "",
          "GlobalIPv6PrefixLen": 0,
          "MacAddress": "02:42:ac:11:00:02"
        }
      }
    }

This is of type `SummaryNetworkSettings` type, a minimal version of
`api/types#NetworkSettings`.

Actually all I need is the network name and the IPAddress fields. If folks
find this addition too big, I can create a `SummaryEndpointSettings` field
as well, containing just the IPAddress field.

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2015-12-14 19:03:23 -08:00
..
daemonbuilder
events
exec
execdriver
graphdriver
links
logger
network Move networking api types to the api/types/networking package. 2015-12-09 13:55:59 -08:00
archive.go
archive_unix.go
archive_windows.go
attach.go
changes.go
commit.go
config.go
config_experimental.go
config_stub.go
config_unix.go
config_windows.go
container_operations.go
container_operations_unix.go Move networking api types to the api/types/networking package. 2015-12-09 13:55:59 -08:00
container_operations_windows.go
create.go
create_unix.go
create_windows.go
daemon.go
daemon_aufs.go
daemon_btrfs.go
daemon_devicemapper.go
daemon_experimental.go
daemon_linux.go
daemon_linux_test.go
daemon_no_aufs.go
daemon_overlay.go
daemon_stub.go
daemon_test.go
daemon_unix.go
daemon_unix_test.go
daemon_unsupported.go
daemon_windows.go
daemon_zfs.go
debugtrap_unix.go
debugtrap_unsupported.go
debugtrap_windows.go
delete.go
delete_test.go
discovery.go
discovery_test.go
errors.go
events.go
exec.go
exec_unix.go
exec_windows.go
export.go
history.go
image_delete.go
images.go
import.go
info.go
inspect.go Move networking api types to the api/types/networking package. 2015-12-09 13:55:59 -08:00
inspect_unix.go
inspect_windows.go
kill.go
list.go Add containers’ networks to /containers/json 2015-12-14 19:03:23 -08:00
list_unix.go
list_windows.go
logdrivers_linux.go
logdrivers_windows.go
logs.go
mounts.go
network.go Move networking api types to the api/types/networking package. 2015-12-09 13:55:59 -08:00
pause.go
README.md
rename.go
resize.go
restart.go
selinux_linux.go
selinux_unsupported.go
start.go
stats.go
stats_collector_unix.go
stats_collector_windows.go
stats_freebsd.go
stats_linux.go
stats_windows.go
stop.go
top_unix.go
top_windows.go
unpause.go
volumes.go
volumes_unit_test.go
volumes_unix.go
volumes_windows.go
wait.go

This directory contains code pertaining to running containers and storing images

Code pertaining to running containers:

  • execdriver

Code pertaining to storing images:

  • graphdriver