When using Testcontainers with Docker daemon version 29.x (e.g., 29.1.3), operations like ExecAsync() and image pulling fail with JSON parsing errors:
JsonException: '0x00' is invalid after a single JSON value. Expected end of data.
or
JsonReaderException: '0x00' is an invalid start of a property name. Expected a '"'.
Root Cause:
The Docker API in version 29.x appears to return responses with embedded null bytes or a different wire format that Docker.DotNet (the library Testcontainers uses internally) doesn't handle correctly. The parsing happens in
Docker.DotNet.JsonSerializer.TryParseJson().
Affected Operations:
- Container exec (DockerContainerOperations.ExecAsync)
- Image pulling (DockerImageOperations.CreateAsync)
Environment:
- Docker: 29.1.3
- Testcontainers.Kafka
- OS: Ubuntu 24.04 / WSL2