Automatically map exposed ports defined in Dockerfile

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

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

評価

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

調査の方向性

まず GenericContainer とその withExposedPorts の処理を読み、次に issue で説明されているエントリーポイント DockerClientFactory.instance().client().inspectImageCmd(...) を調べます。GenericContainer がポートを指定しなかった場合にイメージから公開ポートを導出でき、同時に issue の明示的なポートの場合とポートなしの場合が引き続き定義され、検証されていれば完了です。

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

説明

resolution/acknowledged type/feature

Typically a Docker image will declare what ports it exposes using:
EXPOSE <ports...>

Why is it also necessary to duplicate this information by default for GenericContainer?

Take the quick start example:

@Rule
public GenericContainer redis = new GenericContainer<>("redis:5.0.3-alpine")
                                        .withExposedPorts(6379);

If the user does not explicitly state what ports to expose via withExposedPorts(), could we run DockerClientFactory.instance().client().inspectImageCmd(this.getDockerImageName()).exec(); to run a Docker image inspection and automatically read/set the ports exposed by the Docker image? I know there are situations where a user may not want to expose all (or any) ports of a container, but I think this would be the minority case for Testcontainers users, right?

If we were to do this, the above code example could simply be:

@Rule
public GenericContainer redis = new GenericContainer<>("redis:5.0.3-alpine");
主要言語
Java
スター
8.7k
フォーク
1.9k
平均マージ
2日 17時間
マージ済み PR(30日)
9

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

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

はじめの一歩

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

testcontainers/testcontainers-java のほかの issue

testcontainers/testcontainers-java の issue をすべて見る

似ている issue

Java の issue をもっと見る

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

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