Signed-off-by: Bradley Cicenas <bradley.cicenas@gmail.com>
| ... | ... |
@@ -70,6 +70,7 @@ type Container struct {
|
| 70 | 70 |
ResolvConfPath string |
| 71 | 71 |
HostnamePath string |
| 72 | 72 |
HostsPath string |
| 73 |
+ LogPath string |
|
| 73 | 74 |
Name string |
| 74 | 75 |
Driver string |
| 75 | 76 |
ExecDriver string |
| ... | ... |
@@ -1322,16 +1323,17 @@ func (container *Container) setupWorkingDirectory() error {
|
| 1322 | 1322 |
|
| 1323 | 1323 |
func (container *Container) startLoggingToDisk() error {
|
| 1324 | 1324 |
// Setup logging of stdout and stderr to disk |
| 1325 |
- pth, err := container.logPath("json")
|
|
| 1325 |
+ logPath, err := container.logPath("json")
|
|
| 1326 | 1326 |
if err != nil {
|
| 1327 | 1327 |
return err |
| 1328 | 1328 |
} |
| 1329 |
+ container.LogPath = logPath |
|
| 1329 | 1330 |
|
| 1330 |
- if err := container.daemon.LogToDisk(container.stdout, pth, "stdout"); err != nil {
|
|
| 1331 |
+ if err := container.daemon.LogToDisk(container.stdout, container.LogPath, "stdout"); err != nil {
|
|
| 1331 | 1332 |
return err |
| 1332 | 1333 |
} |
| 1333 | 1334 |
|
| 1334 |
- if err := container.daemon.LogToDisk(container.stderr, pth, "stderr"); err != nil {
|
|
| 1335 |
+ if err := container.daemon.LogToDisk(container.stderr, container.LogPath, "stderr"); err != nil {
|
|
| 1335 | 1336 |
return err |
| 1336 | 1337 |
} |
| 1337 | 1338 |
|
| ... | ... |
@@ -44,6 +44,7 @@ func (daemon *Daemon) ContainerInspect(job *engine.Job) engine.Status {
|
| 44 | 44 |
out.Set("ResolvConfPath", container.ResolvConfPath)
|
| 45 | 45 |
out.Set("HostnamePath", container.HostnamePath)
|
| 46 | 46 |
out.Set("HostsPath", container.HostsPath)
|
| 47 |
+ out.Set("LogPath", container.LogPath)
|
|
| 47 | 48 |
out.SetJson("Name", container.Name)
|
| 48 | 49 |
out.SetInt("RestartCount", container.RestartCount)
|
| 49 | 50 |
out.Set("Driver", container.Driver)
|
| ... | ... |
@@ -101,6 +101,7 @@ To get information on a container use it's ID or instance name: |
| 101 | 101 |
"ResolvConfPath": "/etc/resolv.conf", |
| 102 | 102 |
"HostnamePath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/hostname", |
| 103 | 103 |
"HostsPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/hosts", |
| 104 |
+ "LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log", |
|
| 104 | 105 |
"Name": "/ecstatic_ptolemy", |
| 105 | 106 |
"Driver": "devicemapper", |
| 106 | 107 |
"ExecDriver": "native-0.1", |
| ... | ... |
@@ -341,6 +341,7 @@ Return low-level information on the container `id` |
| 341 | 341 |
}, |
| 342 | 342 |
"HostnamePath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hostname", |
| 343 | 343 |
"HostsPath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hosts", |
| 344 |
+ "LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log", |
|
| 344 | 345 |
"Id": "ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39", |
| 345 | 346 |
"Image": "04c5d3b7b0656168630d3ba35d8889bd0e9caafcaeb3004d2bfbc47e7c5d35d2", |
| 346 | 347 |
"MountLabel": "", |
| ... | ... |
@@ -1913,6 +1914,7 @@ Return low-level information about the exec command `id`. |
| 1913 | 1913 |
"ResolvConfPath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/resolv.conf", |
| 1914 | 1914 |
"HostnamePath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hostname", |
| 1915 | 1915 |
"HostsPath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hosts", |
| 1916 |
+ "LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log", |
|
| 1916 | 1917 |
"Name" : "/test", |
| 1917 | 1918 |
"Driver" : "aufs", |
| 1918 | 1919 |
"ExecDriver" : "native-0.2", |
| ... | ... |
@@ -1238,6 +1238,10 @@ straightforward manner. |
| 1238 | 1238 |
|
| 1239 | 1239 |
$ sudo docker inspect --format='{{.NetworkSettings.MacAddress}}' $INSTANCE_ID
|
| 1240 | 1240 |
|
| 1241 |
+**Get an instance's log path:** |
|
| 1242 |
+ |
|
| 1243 |
+ $ sudo docker inspect --format='{{.LogPath}}' $INSTANCE_ID
|
|
| 1244 |
+ |
|
| 1241 | 1245 |
**List All Port Bindings:** |
| 1242 | 1246 |
|
| 1243 | 1247 |
One can loop over arrays and maps in the results to produce simple text |
| ... | ... |
@@ -34,7 +34,7 @@ func TestInspectApiContainerResponse(t *testing.T) {
|
| 34 | 34 |
t.Fatalf("unable to unmarshal body for %s version: %v", testVersion, err)
|
| 35 | 35 |
} |
| 36 | 36 |
|
| 37 |
- keys := []string{"State", "Created", "Path", "Args", "Config", "Image", "NetworkSettings", "ResolvConfPath", "HostnamePath", "HostsPath", "Name", "Driver", "ExecDriver", "MountLabel", "ProcessLabel", "Volumes", "VolumesRW"}
|
|
| 37 |
+ keys := []string{"State", "Created", "Path", "Args", "Config", "Image", "NetworkSettings", "ResolvConfPath", "HostnamePath", "HostsPath", "LogPath", "Name", "Driver", "ExecDriver", "MountLabel", "ProcessLabel", "Volumes", "VolumesRW"}
|
|
| 38 | 38 |
|
| 39 | 39 |
if testVersion == "v1.11" {
|
| 40 | 40 |
keys = append(keys, "ID") |