mirror of https://github.com/docker/compose.git
Avoid nil pointer when reading logs of a just terminated container.
Hit this when following logs of a container restarted with a health check: ``` panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x168771e] goroutine 1 [running]: github.com/docker/compose-cli/aci.getACIContainerLogs(0x2d85260, 0xc000526c60, 0xc0001465a0, 0x24, 0xc0004f4da0, 0xa, 0xc0004f4db0, 0x7, 0x7ffeefbffab2, 0xb, ...) github.com/docker/compose-cli/aci/aci.go:285 +0x1fe github.com/docker/compose-cli/aci.streamLogs(0x2d85260, 0xc000526c60, 0xc0001465a0, 0x24, 0xc0004f4da0, 0xa, 0xc0004f4db0, 0x7, 0x7ffeefbffab2, 0xb, ...) github.com/docker/compose-cli/aci/aci.go:297 +0x2e5 ``` Signed-off-by: Guillaume Tardif <guillaume.tardif@docker.com>
This commit is contained in:
parent
6a9d7c1371
commit
40334d570a
|
@ -282,6 +282,9 @@ func getACIContainerLogs(ctx context.Context, aciContext store.AciContext, conta
|
|||
if err != nil {
|
||||
return "", fmt.Errorf("cannot get container logs: %v", err)
|
||||
}
|
||||
if logs.Content == nil {
|
||||
return "", nil
|
||||
}
|
||||
return *logs.Content, err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue