Skip to content

Commit

Permalink
Ability to run privileged containers
Browse files Browse the repository at this point in the history
  • Loading branch information
dinamic committed Jul 15, 2024
1 parent 3ddc75e commit 913c88e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Container/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class Container
private Process $process;
private WaitInterface $wait;

private bool $privileged = false;
private ?string $network = null;
private ?string $healthCheckCommand = null;
private int $healthCheckIntervalInMS;
Expand Down Expand Up @@ -108,6 +109,13 @@ public function withPort(string $localPort, string $containerPort): self
return $this;
}

public function withPrivileged(bool $privileged = true): self
{
$this->privileged = $privileged;

return $this;
}

public function withNetwork(string $network): self
{
$this->network = $network;
Expand Down Expand Up @@ -152,6 +160,10 @@ public function run(bool $wait = true): self
$params[] = $this->entryPoint;
}

if ($this->privileged) {
$params[] = '--privileged';
}

$params[] = $this->image;

$this->process = new Process($params);
Expand Down

0 comments on commit 913c88e

Please sign in to comment.