feat: add shm-size for custom docker commands
This commit is contained in:
@@ -677,18 +677,19 @@ function convert_docker_run_to_compose(?string $custom_docker_run_options = null
|
|||||||
'--sysctl',
|
'--sysctl',
|
||||||
'--ulimit',
|
'--ulimit',
|
||||||
'--device',
|
'--device',
|
||||||
|
'--shm-size',
|
||||||
]);
|
]);
|
||||||
$mapping = collect([
|
$mapping = collect([
|
||||||
'--cap-add' => 'cap_add',
|
'--cap-add' => 'cap_add',
|
||||||
'--cap-drop' => 'cap_drop',
|
'--cap-drop' => 'cap_drop',
|
||||||
'--security-opt' => 'security_opt',
|
'--security-opt' => 'security_opt',
|
||||||
'--sysctl' => 'sysctls',
|
'--sysctl' => 'sysctls',
|
||||||
'--ulimit' => 'ulimits',
|
|
||||||
'--device' => 'devices',
|
'--device' => 'devices',
|
||||||
'--init' => 'init',
|
'--init' => 'init',
|
||||||
'--ulimit' => 'ulimits',
|
'--ulimit' => 'ulimits',
|
||||||
'--privileged' => 'privileged',
|
'--privileged' => 'privileged',
|
||||||
'--ip' => 'ip',
|
'--ip' => 'ip',
|
||||||
|
'--shm-size' => 'shm_size',
|
||||||
]);
|
]);
|
||||||
foreach ($matches as $match) {
|
foreach ($matches as $match) {
|
||||||
$option = $match[1];
|
$option = $match[1];
|
||||||
@@ -704,6 +705,7 @@ function convert_docker_run_to_compose(?string $custom_docker_run_options = null
|
|||||||
$options = collect($options);
|
$options = collect($options);
|
||||||
// Easily get mappings from https://github.com/composerize/composerize/blob/master/packages/composerize/src/mappings.js
|
// Easily get mappings from https://github.com/composerize/composerize/blob/master/packages/composerize/src/mappings.js
|
||||||
foreach ($options as $option => $value) {
|
foreach ($options as $option => $value) {
|
||||||
|
// ray($option,$value);
|
||||||
if (! data_get($mapping, $option)) {
|
if (! data_get($mapping, $option)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -728,6 +730,10 @@ function convert_docker_run_to_compose(?string $custom_docker_run_options = null
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
$compose_options->put($mapping[$option], $ulimits);
|
$compose_options->put($mapping[$option], $ulimits);
|
||||||
|
} elseif ($option === '--shm-size') {
|
||||||
|
if (!is_null($value) && is_array($value) && count($value) > 0) {
|
||||||
|
$compose_options->put($mapping[$option], $value[0]);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($list_options->contains($option)) {
|
if ($list_options->contains($option)) {
|
||||||
if ($compose_options->has($mapping[$option])) {
|
if ($compose_options->has($mapping[$option])) {
|
||||||
|
|||||||
Reference in New Issue
Block a user