Skip to content

Commit 8af1b3a

Browse files
committed
Merge pull request #71 from allermedia/swarm-node
Include information about the swarm node a container is on.
2 parents 6d52a2c + 582ce75 commit 8af1b3a

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

GLOCKFILE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
github.com/BurntSushi/toml f87ce853111478914f0bcffa34d43a93643e6eda
22
github.com/Sirupsen/logrus 6ebb4e7b3c24b9fef150d7693e728cb1ebadf1f5
3-
github.com/docker/docker 9d65017069ff12fbf0a6f078ccf91bce42fc8ffb
4-
github.com/fsouza/go-dockerclient 10d10d464f96231c61e16f2d1b7fca3152a7040f
3+
github.com/docker/docker 95dcb2748442fc1f59e8c2e010679e0aea3cef1c
4+
github.com/fsouza/go-dockerclient de7e7a55fa1ff99c88420e104e4966f9ad36c72d

docker-gen.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ type RuntimeContainer struct {
6161
Image DockerImage
6262
Env map[string]string
6363
Volumes map[string]Volume
64+
Node SwarmNode
6465
}
6566

6667
type DockerImage struct {
@@ -69,6 +70,12 @@ type DockerImage struct {
6970
Tag string
7071
}
7172

73+
type SwarmNode struct {
74+
ID string
75+
Name string
76+
Address Address
77+
}
78+
7279
func (i *DockerImage) String() string {
7380
ret := i.Repository
7481
if i.Registry != "" {

docker_client.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ func getContainers(client *docker.Client) ([]*RuntimeContainer, error) {
125125
Addresses: []Address{},
126126
Env: make(map[string]string),
127127
Volumes: make(map[string]Volume),
128+
Node: SwarmNode{},
128129
}
129130
for k, v := range container.NetworkSettings.Ports {
130131
address := Address{
@@ -146,6 +147,13 @@ func getContainers(client *docker.Client) ([]*RuntimeContainer, error) {
146147
ReadWrite: container.VolumesRW[k],
147148
}
148149
}
150+
if container.Node != nil {
151+
runtimeContainer.Node.ID = container.Node.ID
152+
runtimeContainer.Node.Name = container.Node.Name
153+
runtimeContainer.Node.Address = Address{
154+
IP: container.Node.IP,
155+
}
156+
}
149157

150158
runtimeContainer.Env = splitKeyValueSlice(container.Config.Env)
151159
containers = append(containers, runtimeContainer)

0 commit comments

Comments
 (0)