Kevin Simper
Kevin Simper

Reputation: 1707

Explanation of Docker Attach payload

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?

Upvotes: 0

Views: 198

Answers (1)

BMitch
BMitch

Reputation: 265090

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.

Upvotes: 1

Related Questions