mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #10619 from bcicen/add-logpath-to-inspect-container
Add logpath to inspect container
This commit is contained in:
commit
dc37358d8c
6 changed files with 14 additions and 4 deletions
|
@ -70,6 +70,7 @@ type Container struct {
|
|||
ResolvConfPath string
|
||||
HostnamePath string
|
||||
HostsPath string
|
||||
LogPath string
|
||||
Name string
|
||||
Driver string
|
||||
ExecDriver string
|
||||
|
@ -1322,16 +1323,17 @@ func (container *Container) setupWorkingDirectory() error {
|
|||
|
||||
func (container *Container) startLoggingToDisk() error {
|
||||
// Setup logging of stdout and stderr to disk
|
||||
pth, err := container.logPath("json")
|
||||
logPath, err := container.logPath("json")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
container.LogPath = logPath
|
||||
|
||||
if err := container.daemon.LogToDisk(container.stdout, pth, "stdout"); err != nil {
|
||||
if err := container.daemon.LogToDisk(container.stdout, container.LogPath, "stdout"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := container.daemon.LogToDisk(container.stderr, pth, "stderr"); err != nil {
|
||||
if err := container.daemon.LogToDisk(container.stderr, container.LogPath, "stderr"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ func (daemon *Daemon) ContainerInspect(job *engine.Job) engine.Status {
|
|||
out.Set("ResolvConfPath", container.ResolvConfPath)
|
||||
out.Set("HostnamePath", container.HostnamePath)
|
||||
out.Set("HostsPath", container.HostsPath)
|
||||
out.Set("LogPath", container.LogPath)
|
||||
out.SetJson("Name", container.Name)
|
||||
out.SetInt("RestartCount", container.RestartCount)
|
||||
out.Set("Driver", container.Driver)
|
||||
|
|
|
@ -101,6 +101,7 @@ To get information on a container use it's ID or instance name:
|
|||
"ResolvConfPath": "/etc/resolv.conf",
|
||||
"HostnamePath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/hostname",
|
||||
"HostsPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/hosts",
|
||||
"LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log",
|
||||
"Name": "/ecstatic_ptolemy",
|
||||
"Driver": "devicemapper",
|
||||
"ExecDriver": "native-0.1",
|
||||
|
|
|
@ -341,6 +341,7 @@ Return low-level information on the container `id`
|
|||
},
|
||||
"HostnamePath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hostname",
|
||||
"HostsPath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hosts",
|
||||
"LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log",
|
||||
"Id": "ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39",
|
||||
"Image": "04c5d3b7b0656168630d3ba35d8889bd0e9caafcaeb3004d2bfbc47e7c5d35d2",
|
||||
"MountLabel": "",
|
||||
|
@ -1913,6 +1914,7 @@ Return low-level information about the exec command `id`.
|
|||
"ResolvConfPath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/resolv.conf",
|
||||
"HostnamePath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hostname",
|
||||
"HostsPath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hosts",
|
||||
"LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log",
|
||||
"Name" : "/test",
|
||||
"Driver" : "aufs",
|
||||
"ExecDriver" : "native-0.2",
|
||||
|
|
|
@ -1238,6 +1238,10 @@ straightforward manner.
|
|||
|
||||
$ sudo docker inspect --format='{{.NetworkSettings.MacAddress}}' $INSTANCE_ID
|
||||
|
||||
**Get an instance's log path:**
|
||||
|
||||
$ sudo docker inspect --format='{{.LogPath}}' $INSTANCE_ID
|
||||
|
||||
**List All Port Bindings:**
|
||||
|
||||
One can loop over arrays and maps in the results to produce simple text
|
||||
|
|
|
@ -34,7 +34,7 @@ func TestInspectApiContainerResponse(t *testing.T) {
|
|||
t.Fatalf("unable to unmarshal body for %s version: %v", testVersion, err)
|
||||
}
|
||||
|
||||
keys := []string{"State", "Created", "Path", "Args", "Config", "Image", "NetworkSettings", "ResolvConfPath", "HostnamePath", "HostsPath", "Name", "Driver", "ExecDriver", "MountLabel", "ProcessLabel", "Volumes", "VolumesRW"}
|
||||
keys := []string{"State", "Created", "Path", "Args", "Config", "Image", "NetworkSettings", "ResolvConfPath", "HostnamePath", "HostsPath", "LogPath", "Name", "Driver", "ExecDriver", "MountLabel", "ProcessLabel", "Volumes", "VolumesRW"}
|
||||
|
||||
if testVersion == "v1.11" {
|
||||
keys = append(keys, "ID")
|
||||
|
|
Loading…
Add table
Reference in a new issue