testcontainers / testcontainers/testcontainers-java

[Bug]: Docker communication error using DOCKER_HOST localhost (1.17+)

オープン
#8,773 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

type/bug
主要言語
Java
スター
8.7k
フォーク
1.9k
平均マージ
2日 17時間
マージ済み PR(30日)
9

説明

Module

Core

Testcontainers version

1.19.8

Using the latest Testcontainers version?

Yes

Host OS

Windows 11

Host Arch

AMD64

Docker version
Client: Docker Engine - Community
 Version:           24.0.7
 API version:       1.43
 Go version:        go1.20.10
 Git commit:        afdd53b
 Built:             Thu Oct 26 09:08:01 2023
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          24.0.7
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.10
  Git commit:       311b9ff
  Built:            Thu Oct 26 09:08:01 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.25
  GitCommit:        d8f198a4ed8892c764191ef7b3b06d8a2eeb5c7f
 runc:
  Version:          1.1.10
  GitCommit:        v1.1.10-0-g18a0cb0
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
What happened?

When I start my Junit tests in IntelliJ, it is failing and logging :

2024-06-12T11:04:16.067+02:00 WARN --- [ main] o.t.d.DockerClientProviderStrategy : DOCKER_HOST tcp://localhost:2375 is not listening
2024-06-12T11:04:16.099+02:00 INFO --- [ main] .t.d.DockerMachineClientProviderStrategy : docker-machine executable was not found on PATH ([C:\...])
2024-06-12T11:04:16.102+02:00 ERROR --- [ main] o.t.d.DockerClientProviderStrategy : Could not find a valid Docker environment. Please check configuration. Attempted configurations were:
As no valid configuration was found, execution cannot continue.

I have configured my DOCKER_HOST with tcp://localhost:2375 and since testcontainers 1.17.0, it is no longer working as is.
I since changed my DOCKER_HOST replacing "localhost" with the WSL eth0 IP and it is working again, but I don't think it is a good solution.

I'm using WSL2, here is the WSL --version detail :

Version WSL : 2.1.5.0
Version du noyau : 5.15.146.1-2
Version WSLg : 1.0.60
Version MSRDC : 1.2.5105
Version direct3D : 1.611.1-81528511
Version de DXCore : 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Version de Windows : 10.0.22631.3593

This problem only occur since testcontainers 1.17.0 and later versions.
Testcontainers 1.16.3 (and older) works great.

My internet browser is accessing DOCKER through http://localhost:2375/ (or my WSL eth0 IP) perfectly.

Relevant log output

No response

Additional Information

No response

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

DockerClientProviderStrategy と DockerMachineClientProviderStrategy から始め、報告されている DOCKER_HOST tcp://localhost:2375 の動作を再現ケースとして使用します。Windows 11 と WSL2 上で、Testcontainers 1.16.3 と 1.17.0 以降を比較します。報告されたセットアップに対するリグレッションカバレッジがあり、WSL eth0 IP を必要とせずに localhost ベースの Docker 通信が再び機能すれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
docker, java
領域
testing
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。