feat: configure docker-in-docker container with host networking and custom daemon settings
This commit is contained in:
@@ -532,9 +532,9 @@ SH;
|
|||||||
$rm = $this->runHostCommandChecked('docker rm -f ' . escapeshellarg($container) . ' >/dev/null 2>&1 || true');
|
$rm = $this->runHostCommandChecked('docker rm -f ' . escapeshellarg($container) . ' >/dev/null 2>&1 || true');
|
||||||
$send(['type' => 'cmd_done', 'rc' => $rm['rc']]);
|
$send(['type' => 'cmd_done', 'rc' => $rm['rc']]);
|
||||||
|
|
||||||
$cmdRun = 'docker run --privileged -d --name ' . $container . ' ubuntu:22.04 sleep infinity';
|
$cmdRun = 'docker run --network host --privileged -d --name ' . $container . ' ubuntu:22.04 sleep infinity';
|
||||||
$send(['type' => 'cmd', 'cmd' => $cmdRun]);
|
$send(['type' => 'cmd', 'cmd' => $cmdRun]);
|
||||||
$run = $this->runHostCommandChecked('docker run --privileged -d -v /var/run/docker.sock:/var/run/docker.sock --name ' . escapeshellarg($container) . ' ubuntu:22.04 sleep infinity');
|
$run = $this->runHostCommandChecked('docker run --network host --privileged -d -v /var/run/docker.sock:/var/run/docker.sock --name ' . escapeshellarg($container) . ' ubuntu:22.04 sleep infinity');
|
||||||
if ($run['rc'] !== 0) {
|
if ($run['rc'] !== 0) {
|
||||||
$send(['type' => 'error', 'error' => 'Docker not accessible: ' . trim($run['out'])]);
|
$send(['type' => 'error', 'error' => 'Docker not accessible: ' . trim($run['out'])]);
|
||||||
return;
|
return;
|
||||||
|
|||||||
+1
-1
@@ -57,7 +57,7 @@ services:
|
|||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
DOCKER_TLS_CERTDIR: ""
|
DOCKER_TLS_CERTDIR: ""
|
||||||
|
command: ["dockerd", "--host=tcp://0.0.0.0:2375", "--host=unix:///var/run/docker.sock", "--tls=false", "--dns=8.8.8.8", "--dns=1.1.1.1", "--mtu=1200"]
|
||||||
volumes:
|
volumes:
|
||||||
- dind_data:/var/lib/docker
|
- dind_data:/var/lib/docker
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user