Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

feat: support dns custom docker option

tikimo6692ff3e363c
diff --git a/bootstrap/helpers/docker.php b/bootstrap/helpers/docker.php
index 5905ed3c1b..e97bc3732d 100644
--- a/bootstrap/helpers/docker.php
+++ b/bootstrap/helpers/docker.php
@@ -1000,6 +1000,7 @@ function convertDockerRunToCompose(?string $custom_docker_run_options = null)
'--ulimit',
'--device',
'--shm-size',
+ '--dns',
]);
$mapping = collect([
'--cap-add' => 'cap_add',
@@ -1013,6 +1014,7 @@ function convertDockerRunToCompose(?string $custom_docker_run_options = null)
'--ip' => 'ip',
'--ip6' => 'ip6',
'--shm-size' => 'shm_size',
+ '--dns' => 'dns',
'--gpus' => 'gpus',
'--hostname' => 'hostname',
'--entrypoint' => 'entrypoint',
diff --git a/tests/Feature/CommandInjectionSecurityTest.php b/tests/Feature/CommandInjectionSecurityTest.php
index b327184a42..5fa5c08d23 100644
--- a/tests/Feature/CommandInjectionSecurityTest.php
+++ b/tests/Feature/CommandInjectionSecurityTest.php
@@ -733,6 +733,7 @@ describe('custom_docker_run_options validation', function () {
'--entrypoint "sh -c \'npm start\'"',
'--entrypoint "sh -c \'php artisan schedule:work\'"',
'--hostname "my-host"',
+ '--dns 10.0.0.10 --dns=1.1.1.1',
]);
});
diff --git a/tests/Feature/DockerCustomCommandsTest.php b/tests/Feature/DockerCustomCommandsTest.php
index 74bff20438..299709ffd9 100644
--- a/tests/Feature/DockerCustomCommandsTest.php
+++ b/tests/Feature/DockerCustomCommandsTest.php
@@ -46,6 +46,24 @@ test('ConvertIp', function () {
]);
});
+test('ConvertDns', function () {
+ $input = '--dns 10.0.0.10 --dns=1.1.1.1';
+ $output = convertDockerRunToCompose($input);
+ expect($output)->toBe([
+ 'dns' => ['10.0.0.10', '1.1.1.1'],
+ ]);
+});
+
+test('ConvertDnsWithOtherOptions', function () {
+ $input = '--cap-add=NET_ADMIN --dns 10.0.0.10 --init';
+ $output = convertDockerRunToCompose($input);
+ expect($output)->toBe([
+ 'cap_add' => ['NET_ADMIN'],
+ 'dns' => ['10.0.0.10'],
+ 'init' => true,
+ ]);
+});
+
test('ConvertPrivilegedAndInit', function () {
$input = '---privileged --init';
$output = convertDockerRunToCompose($input);