Skip to content

Commit 087641a

Browse files
committed
Copy files before starting container
Move the copy-to-container step before containerStart() so files configured with withCopyFilesToContainer(), withCopyDirectoriesToContainer(), or withCopyContentToContainer() are available when the container entrypoint starts. This avoids races for images that read configuration immediately on startup, such as Caddy loading /etc/caddy/Caddyfile before the test-provided file has been copied into the container.
1 parent 75bca05 commit 087641a

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/Container/GenericContainer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,12 +338,12 @@ public function start(): StartedGenericContainer
338338
return $this->start();
339339
}
340340

341-
$this->dockerClient->containerStart($this->id);
342-
343341
if ($this->filesToCopy !== [] || $this->directoriesToCopy !== [] || $this->contentsToCopy !== []) {
344342
$this->copyToContainer();
345343
}
346344

345+
$this->dockerClient->containerStart($this->id);
346+
347347
$startedContainer = new StartedGenericContainer($this->id);
348348
$this->waitStrategy->wait($startedContainer);
349349

0 commit comments

Comments
 (0)