mirror of
https://github.com/stan220/testcontainers-php.git
synced 2026-09-12 09:29:35 +00:00
fix issue with passing envs into the container. Remove container registry usage.
This commit is contained in:
@@ -14,7 +14,6 @@ use Docker\API\Model\PortBinding;
|
||||
use Docker\Docker;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Testcontainers\ContainerRuntime\ContainerRuntimeClient;
|
||||
use Testcontainers\Registry;
|
||||
use Testcontainers\Wait\WaitForContainerRunning;
|
||||
use Testcontainers\Wait\WaitInterface;
|
||||
|
||||
@@ -225,7 +224,11 @@ class GenericContainer
|
||||
$hostConfig->setPortBindings($portMap);
|
||||
$containerCreatePostBody->setHostConfig($hostConfig);
|
||||
$containerCreatePostBody->setImage($this->image);
|
||||
//$containerCreatePostBody->setEnv($this->env);
|
||||
$envs = [];
|
||||
foreach ($this->env as $key => $value) {
|
||||
$envs[] = $key . '=' . $value;
|
||||
}
|
||||
$containerCreatePostBody->setEnv($envs);
|
||||
|
||||
$containerCreateResponse = $this->dockerClient->containerCreate($containerCreatePostBody);
|
||||
$this->id = $containerCreateResponse?->getId() ?? '';
|
||||
@@ -237,8 +240,6 @@ class GenericContainer
|
||||
return $this->start();
|
||||
}
|
||||
|
||||
Registry::add($this);
|
||||
|
||||
$this->dockerClient->containerStart($this->id);
|
||||
|
||||
if(!isset($this->wait)) {
|
||||
@@ -260,8 +261,6 @@ class GenericContainer
|
||||
$this->dockerClient->containerStop($this->id);
|
||||
$this->dockerClient->containerDelete($this->id);
|
||||
|
||||
Registry::remove($this);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -317,7 +316,7 @@ class GenericContainer
|
||||
{
|
||||
$response = $this->dockerClient->containerInspect($this->id);
|
||||
$settings = $response->getNetworkSettings();
|
||||
var_dump($settings);
|
||||
//var_dump($settings);
|
||||
|
||||
$ports = [];
|
||||
foreach ($settings->getPorts() as $port => $value) {
|
||||
|
||||
Reference in New Issue
Block a user