Skip to content

Commit

Permalink
Skip first 8 bytes of docker API stream
Browse files Browse the repository at this point in the history
  • Loading branch information
manuel-koch committed Jul 18, 2024
1 parent 7642a4d commit 81c8446
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion watchingcontainers.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,12 @@ func readln(r *bufio.Reader) (string, error) {
)
for isPrefix && err == nil {
line, isPrefix, err = r.ReadLine()
ln = append(ln, line...)
if err == nil && len(line) > 8 {
// First 8 bytes of every line contain additional docker API information for the stream.
// See https://docs.docker.com/engine/api/v1.26/#tag/Container/operation/ContainerAttach
// We just skip it here.
ln = append(ln, line[8:]...)
}
}
return string(ln), err
}

0 comments on commit 81c8446

Please sign in to comment.