Skip to content

Add support for NetworkSettings.Networks #144

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

Merged
merged 2 commits into from
Dec 20, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion GLOCKFILE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github.com/BurntSushi/toml f87ce853111478914f0bcffa34d43a93643e6eda
github.com/Sirupsen/logrus 6ebb4e7b3c24b9fef150d7693e728cb1ebadf1f5
github.com/docker/docker 2606a2e4d3bf810ec82e373a6cd334e22e504e83
github.com/fsouza/go-dockerclient 1399676f53e6ccf46e0bf00751b21bed329bc60e
github.com/fsouza/go-dockerclient 54afc1babbc57f075f958f84904251332bd8fd73
13 changes: 13 additions & 0 deletions docker-gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@ type Address struct {
HostIP string
}

type Network struct {
IP string
Name string
Gateway string
EndpointID string
IPv6Gateway string
GlobalIPv6Address string
MacAddress string
GlobalIPv6PrefixLen int
IPPrefixLen int
}

type Volume struct {
Path string
HostPath string
Expand All @@ -64,6 +76,7 @@ type Volume struct {
type RuntimeContainer struct {
ID string
Addresses []Address
Networks []Network
Gateway string
Name string
Hostname string
Expand Down
17 changes: 17 additions & 0 deletions docker_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ func getContainers(client *docker.Client) ([]*RuntimeContainer, error) {
Hostname: container.Config.Hostname,
Gateway: container.NetworkSettings.Gateway,
Addresses: []Address{},
Networks: []Network{},
Env: make(map[string]string),
Volumes: make(map[string]Volume),
Node: SwarmNode{},
Expand All @@ -148,6 +149,22 @@ func getContainers(client *docker.Client) ([]*RuntimeContainer, error) {
address)

}
for k, v := range container.NetworkSettings.Networks {
network := Network{
IP: v.IPAddress,
Name: k,
Gateway: v.Gateway,
EndpointID: v.EndpointID,
IPv6Gateway: v.IPv6Gateway,
GlobalIPv6Address: v.GlobalIPv6Address,
MacAddress: v.MacAddress,
GlobalIPv6PrefixLen: v.GlobalIPv6PrefixLen,
IPPrefixLen: v.IPPrefixLen,
}

runtimeContainer.Networks = append(runtimeContainer.Networks,
network)
}
for k, v := range container.Volumes {
runtimeContainer.Volumes[k] = Volume{
Path: k,
Expand Down