[Bug]: MalformedChunkCodingException since Update to 1.21.4/2.0.3
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
まず、PostgreSQLContainer、PullAlwaysPolicy、および報告された Windows Docker セットアップで失敗を再現します。失敗している環境チェックの周辺にある DockerClientProviderStrategy と NpipeSocketClientProviderStrategy を読み、MalformedChunkCodingException に至る経路を調査します。報告されたセットアップで、MalformedChunkCodingException エラーなしにコンテナを起動できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Module
Core
Testcontainers version
1.21.4, 2.0.3
Using the latest Testcontainers version?
Yes
Host OS
Windows
Host Arch
X64
Docker version
Client:
Version: 29.0.2-rd
API version: 1.51 (downgraded from 1.52)
Go version: go1.25.4
Git commit: 5a2d7eb
Built: Tue Nov 18 23:34:16 2025
OS/Arch: windows/amd64
Context: default
Server:
Engine:
Version: 28.3.3
API version: 1.51 (minimum version 1.24)
Go version: go1.24.8
Git commit: bea959c7b793b32a893820b97c4eadc7c87fabb0
Built: Sun Oct 12 08:01:14 2025
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v2.1.5
GitCommit: fcd43222d6b07379a4be9786bda52438f0dd16a1
runc:
Version: 1.3.3
GitCommit: d842d7719497cc3b774fd71620278ac9e17710e0
docker-init:
Version: 0.19.0
GitCommit:
What happened?
Hi,
I described the problem in a comment in #11254 but given the nature of it, I think it warrants its own issue ticket.
Since updating to Testcontainers 1.21.4/2.0.3 we are occasionally encountering an exception:
NpipeSocketClientProviderStrategy: failed with exception RuntimeException (com.github.dockerjava.zerodep.shaded.org.apache.hc.core5.http.MalformedChunkCodingException: Bad chunk header: ). Root cause MalformedChunkCodingException (Bad chunk header: )
I can reproduce it with something simple as the following code. For some reason it becomes more probable when running in debug mode.
try ( final PostgreSQLContainer<?> container = new PostgreSQLContainer<>( "postgres:14" ) ) {
container.start( );
}
I use a custom policy to make sure that the image is always pulled.
public final class PullAlwaysPolicy implements ImagePullPolicy {
@Override
public boolean shouldPull( final DockerImageName imageName ) {
return true;
}
}
Thank you and best regards
Nils
Relevant log output
Feb. 02, 2026 10:17:54 AM org.testcontainers.images.PullPolicy defaultPolicy
INFORMATION: Found configured Image Pull Policy: class com.example.demo.PullAlwaysPolicy
Feb. 02, 2026 10:17:54 AM org.testcontainers.images.PullPolicy defaultPolicy
INFORMATION: Image pull policy will be performed by: com.example.demo.PullAlwaysPolicy@5d76b067
Feb. 02, 2026 10:17:54 AM org.testcontainers.utility.ImageNameSubstitutor instance
INFORMATION: Image name substitution will be performed by: DefaultImageNameSubstitutor (composite of 'ConfigurationFileImageNameSubstitutor' and 'PrefixingImageNameSubstitutor')
Feb. 02, 2026 10:17:54 AM org.testcontainers.DockerClientFactory getOrInitializeStrategy
INFORMATION: Testcontainers version: 2.0.3
Feb. 02, 2026 10:17:54 AM org.testcontainers.dockerclient.DockerClientProviderStrategy lambda$loadConfiguredStrategy$9
INFORMATION: Loaded org.testcontainers.dockerclient.NpipeSocketClientProviderStrategy from ~/.testcontainers.properties, will try it first
Feb. 02, 2026 10:17:55 AM org.testcontainers.dockerclient.DockerMachineClientProviderStrategy isApplicable
INFORMATION: docker-machine executable was not found on PATH ([REDACTED])
Feb. 02, 2026 10:17:55 AM org.testcontainers.dockerclient.DockerClientProviderStrategy lambda$getFirstValidStrategy$7
SCHWERWIEGEND: Could not find a valid Docker environment. Please check configuration. Attempted configurations were:
NpipeSocketClientProviderStrategy: failed with exception RuntimeException (com.github.dockerjava.zerodep.shaded.org.apache.hc.core5.http.MalformedChunkCodingException: Bad chunk header: ). Root cause MalformedChunkCodingException (Bad chunk header: )As no valid configuration was found, execution cannot continue.
See https://java.testcontainers.org/on_failure.html for more details.
Exception in thread "main" java.lang.IllegalStateException: Could not find a valid Docker environment. Please see logs and check configuration
at org.testcontainers.dockerclient.DockerClientProviderStrategy.lambda$getFirstValidStrategy$7(DockerClientProviderStrategy.java:274)
at java.base/java.util.Optional.orElseThrow(Optional.java:403)
at org.testcontainers.dockerclient.DockerClientProviderStrategy.getFirstValidStrategy(DockerClientProviderStrategy.java:265)
at org.testcontainers.DockerClientFactory.getOrInitializeStrategy(DockerClientFactory.java:154)
at org.testcontainers.DockerClientFactory.client(DockerClientFactory.java:196)
at org.testcontainers.DockerClientFactory$1.getDockerClient(DockerClientFactory.java:108)
at com.github.dockerjava.api.DockerClientDelegate.authConfig(DockerClientDelegate.java:109)
at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:316)
at com.example.demo.Main.main(Main.java:9)
Additional Information
No response
- 主要言語
- Java
- スター
- 8.7k
- フォーク
- 1.9k
- 平均マージ
- 17時間 38分
- マージ済み PR(30日)
- 3
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
testcontainers/testcontainers-java のほかの issue
-
type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
testcontainers/testcontainers-java#11997 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Enhancement]: Document why singleton containers are required under Spring's test context cachingオープンtype/enhancement
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
testcontainers/testcontainers-java#11967 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
testcontainers/testcontainers-java#11941 ·
メンテナーはふだん 1 日以内に返信
-
type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
testcontainers/testcontainers-java#11829 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
type/enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
testcontainers/testcontainers-java#11578 ·
メンテナーはふだん 1 日以内に返信
testcontainers/testcontainers-java の issue をすべて見る
似ている issue
-
cbor
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
FasterXML/jackson-dataformats-binary#844 ·
メンテナーはふだん 1 日以内に返信
-
improvement
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/iceberg#18351 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
repowise-dev/repowise#2945 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Interpolating settings.xml can lead to malformed XML when variable value contains double-hyphenオープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
apache/maven#13321 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
liquid-java/liquidjava#321 ·
メンテナーはふだん 2 日以内に返信