No host port mapping after creating container
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 38/100
Research direction
Start with MySQLContainer::make(), run(), and getAddress(), then compare the container's Docker port configuration with the reported docker inspect output. Reproduce the PDO connection using the shown setup and verify the expected host and port mapping; the issue is done when the container can be reached from the host without the timeout.
Written by the indexing model from the issue text.
Description
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
- Dominant language
- PHP
- Stars
- 215
- Forks
- 34
- Avg merge
- 1h 59m
- Merged PRs (30d)
- 3
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from testcontainers/testcontainers-php
-
Difficulty 4/5 3-5 days Newbie friendliness 38/100
testcontainers/testcontainers-php#57 · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
All issues in testcontainers/testcontainers-php
Similar issues
-
Bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Automattic/safe-publish#594 ·
-
needs-triage Platform(Default)
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
HttpClient
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
symfony/symfony-docs#23092 ·
-
sync-en
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
sync-en
Difficulty 1/5 Under an hour Newbie friendliness 95/100