Skip to content

Commit

Permalink
Add Volumes to RuntimeContainer
Browse files Browse the repository at this point in the history
  • Loading branch information
md5 committed Dec 7, 2014
1 parent 0d814b3 commit aa601ee
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docker-gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,20 @@ type Address struct {
Proto string
}

type Volume struct {
Path string
HostPath string
ReadWrite bool
}

type RuntimeContainer struct {
ID string
Addresses []Address
Gateway string
Name string
Image DockerImage
Env map[string]string
Volumes map[string]Volume
}

type DockerImage struct {
Expand Down
8 changes: 8 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) {
Gateway: container.NetworkSettings.Gateway,
Addresses: []Address{},
Env: make(map[string]string),
Volumes: make(map[string]Volume),
}
for k, v := range container.NetworkSettings.Ports {
address := Address{
Expand All @@ -138,6 +139,13 @@ func getContainers(client *docker.Client) ([]*RuntimeContainer, error) {
address)

}
for k, v := range container.Volumes {
runtimeContainer.Volumes[k] = Volume{
Path: k,
HostPath: v,
ReadWrite: container.VolumesRW[k],
}
}

for _, entry := range container.Config.Env {
parts := strings.Split(entry, "=")
Expand Down

0 comments on commit aa601ee

Please sign in to comment.