0

In the docker documentation there is a piece about the api for attach to logs. https://docs.docker.com/engine/reference/api/docker_remote_api_v1.24/#/attach-to-a-container

There is this line I don't understand:

SIZE1, SIZE2, SIZE3, SIZE4 are the four bytes of the uint32 size encoded as big endian.

What does that mean?

1 Answer 1

1

It's an 8 byte header packet, and a uint32 exceeds the size for one byte and would be different for different platforms (little vs big endian). So Docker has explicitly defined the format for their uint32 packet over the network. Look into integer network vs host formatting for more details, in c, you have functions like uint32 htonl(uint32) where you'd pass in the 4 byte network formatted integer to get out the host formatted integer.

Sign up to request clarification or add additional context in comments.

5 Comments

Thanks for answering, still very complicated for what I know, I just trying to show the logs on my website. I get the first byte shows which type it is, but not how to use the size.
Attaching is very different from showing the logs. Attaching creates an interactive session and it's implementing a stream, probably with tty and multiple io channels, over the rest protocol. If you just want to output the logs to a webpage, I'd use the logs api.
Do you know what it is used for, because that is not very clear either from the docs!
See the documentation the cli's for docker attach vs docker logs, very different commands. These API's are just the back ends for those.
Sorry, I meant the uint32 size encoded as big endian

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.