mirror of https://github.com/docker/compose.git
Merge pull request #347 from docker/inspect_platform
Add ”Platform” in docker inspect result, showing container OS
This commit is contained in:
commit
b1d923d5a0
|
@ -327,6 +327,7 @@ func ContainerGroupToContainer(containerID string, cg containerinstance.Containe
|
||||||
if cc.InstanceView != nil && cc.InstanceView.CurrentState != nil {
|
if cc.InstanceView != nil && cc.InstanceView.CurrentState != nil {
|
||||||
status = *cc.InstanceView.CurrentState.State
|
status = *cc.InstanceView.CurrentState.State
|
||||||
}
|
}
|
||||||
|
platform := string(cg.OsType)
|
||||||
|
|
||||||
c := containers.Container{
|
c := containers.Container{
|
||||||
ID: containerID,
|
ID: containerID,
|
||||||
|
@ -341,6 +342,7 @@ func ContainerGroupToContainer(containerID string, cg containerinstance.Containe
|
||||||
PidsLimit: 0,
|
PidsLimit: 0,
|
||||||
Labels: nil,
|
Labels: nil,
|
||||||
Ports: ToPorts(cg.IPAddress, *cc.Ports),
|
Ports: ToPorts(cg.IPAddress, *cc.Ports),
|
||||||
|
Platform: platform,
|
||||||
}
|
}
|
||||||
|
|
||||||
return c, nil
|
return c, nil
|
||||||
|
|
|
@ -62,6 +62,7 @@ func (suite *ConvertTestSuite) TestContainerGroupToContainer() {
|
||||||
}},
|
}},
|
||||||
IP: to.StringPtr("42.42.42.42"),
|
IP: to.StringPtr("42.42.42.42"),
|
||||||
},
|
},
|
||||||
|
OsType: "Linux",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
myContainer := containerinstance.Container{
|
myContainer := containerinstance.Container{
|
||||||
|
@ -95,6 +96,7 @@ func (suite *ConvertTestSuite) TestContainerGroupToContainer() {
|
||||||
Command: "mycommand",
|
Command: "mycommand",
|
||||||
CPULimit: 3,
|
CPULimit: 3,
|
||||||
MemoryLimit: 107374182,
|
MemoryLimit: 107374182,
|
||||||
|
Platform: "Linux",
|
||||||
Ports: []containers.Port{{
|
Ports: []containers.Port{{
|
||||||
HostPort: uint32(80),
|
HostPort: uint32(80),
|
||||||
ContainerPort: uint32(80),
|
ContainerPort: uint32(80),
|
||||||
|
|
|
@ -10,5 +10,6 @@
|
||||||
"PidsCurrent": 0,
|
"PidsCurrent": 0,
|
||||||
"PidsLimit": 0,
|
"PidsLimit": 0,
|
||||||
"Labels": null,
|
"Labels": null,
|
||||||
"Ports": null
|
"Ports": null,
|
||||||
|
"Platform": "Linux"
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ type Container struct {
|
||||||
PidsLimit uint64
|
PidsLimit uint64
|
||||||
Labels []string
|
Labels []string
|
||||||
Ports []Port
|
Ports []Port
|
||||||
|
Platform string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Port represents a published port of a container
|
// Port represents a published port of a container
|
||||||
|
|
|
@ -60,6 +60,7 @@ func (cs *containerService) Inspect(ctx context.Context, id string) (containers.
|
||||||
return containers.Container{
|
return containers.Container{
|
||||||
ID: "id",
|
ID: "id",
|
||||||
Image: "nginx",
|
Image: "nginx",
|
||||||
|
Platform: "Linux",
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,6 +92,7 @@ func (ms *local) Inspect(ctx context.Context, id string) (containers.Container,
|
||||||
Status: status,
|
Status: status,
|
||||||
Image: c.Image,
|
Image: c.Image,
|
||||||
Command: command,
|
Command: command,
|
||||||
|
Platform: c.Platform,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,5 +10,6 @@
|
||||||
"PidsCurrent": 0,
|
"PidsCurrent": 0,
|
||||||
"PidsLimit": 0,
|
"PidsLimit": 0,
|
||||||
"Labels": null,
|
"Labels": null,
|
||||||
"Ports": null
|
"Ports": null,
|
||||||
|
"Platform": "Linux"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue