feat: add --gpu support for custom docker command
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
test('ConvertCapAdd', function () {
|
||||
$input = '--cap-add=NET_ADMIN --cap-add=NET_RAW --cap-add SYS_ADMIN';
|
||||
$output = convert_docker_run_to_compose($input);
|
||||
$output = convertDockerRunToCompose($input);
|
||||
expect($output)->toBe([
|
||||
'cap_add' => ['NET_ADMIN', 'NET_RAW', 'SYS_ADMIN'],
|
||||
]);
|
||||
@@ -10,7 +10,7 @@ test('ConvertCapAdd', function () {
|
||||
|
||||
test('ConvertIp', function () {
|
||||
$input = '--cap-add=NET_ADMIN --cap-add=NET_RAW --cap-add SYS_ADMIN --ip 127.0.0.1 --ip 127.0.0.2';
|
||||
$output = convert_docker_run_to_compose($input);
|
||||
$output = convertDockerRunToCompose($input);
|
||||
expect($output)->toBe([
|
||||
'cap_add' => ['NET_ADMIN', 'NET_RAW', 'SYS_ADMIN'],
|
||||
'ip' => ['127.0.0.1', '127.0.0.2'],
|
||||
@@ -19,7 +19,7 @@ test('ConvertIp', function () {
|
||||
|
||||
test('ConvertPrivilegedAndInit', function () {
|
||||
$input = '---privileged --init';
|
||||
$output = convert_docker_run_to_compose($input);
|
||||
$output = convertDockerRunToCompose($input);
|
||||
expect($output)->toBe([
|
||||
'privileged' => true,
|
||||
'init' => true,
|
||||
@@ -28,7 +28,7 @@ test('ConvertPrivilegedAndInit', function () {
|
||||
|
||||
test('ConvertUlimit', function () {
|
||||
$input = '--ulimit nofile=262144:262144';
|
||||
$output = convert_docker_run_to_compose($input);
|
||||
$output = convertDockerRunToCompose($input);
|
||||
expect($output)->toBe([
|
||||
'ulimits' => [
|
||||
'nofile' => [
|
||||
@@ -38,3 +38,19 @@ test('ConvertUlimit', function () {
|
||||
],
|
||||
]);
|
||||
});
|
||||
|
||||
test('ConvertGpus', function () {
|
||||
$input = '--gpus all';
|
||||
$output = convertDockerRunToCompose($input);
|
||||
expect($output)->toBe([
|
||||
'gpus' => 'all',
|
||||
]);
|
||||
});
|
||||
|
||||
test('ConvertGpusWithQuotes', function () {
|
||||
$input = '--gpus "device=0"';
|
||||
$output = convertDockerRunToCompose($input);
|
||||
expect($output)->toBe([
|
||||
'gpus' => '"device=0"',
|
||||
]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user