Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

No host port mapping after creating container

オープン
#3 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

評価

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

調査の方向性

MySQLContainer::make() から始め、run() と getAddress() を実行し、次にコンテナの Docker ポート設定と報告された docker inspect の出力を比較します。示されているセットアップを使って PDO 接続を再現し、想定されるホストとポートのマッピングを確認します。コンテナにホストからタイムアウトなしで到達できれば、issue は完了です。

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

説明

I noticed when creating a new MySQLContainer like so

protected function setUp(): void
{
      $this->container = MySQLContainer::make();
      $this->container->withMySQLDatabase('pimcore');
      $this->container->withMySQLUser('pimcore_user', 'pimcore');
      try {
          $this->container->run();
      } catch (JsonException $e) {
          $this->fail($e->getMessage());
      }
}

but when checking out the docker container with docker ps and docker inspect there is no port mapped to the host (localhost). And then when I try to connect to it like so

$this->pdo = new PDO(
      sprintf('mysql:host=%s;port=3306', $this->container->getAddress()),
      'pimcore_user',
      'pimcore',
);

host missing when inspecting the container

"Ports": {
      "3306/tcp": null,
      "33060/tcp": null
},

I get this timeout error

1) Tests\App\journey\ContactIntegrationTest::testGetAllAction
PDOException: SQLSTATE[HY000] [2002] Operation timed out

here the container in Docker Desktop
Bildschirm­foto 2023-12-21 um 11 05 05

主要言語
PHP
スター
214
フォーク
34
平均マージ
1時間 19分
マージ済み PR(30日)
2

環境構築

  • Dockerfile または Docker Compose ファイルあり
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

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

testcontainers/testcontainers-php のほかの issue

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

似ている issue

PHP の issue をもっと見る

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

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