Add support for volume binds and additional options

This commit is contained in:
Mario Romero 2023-09-06 22:43:54 -03:00
parent 64751fb294
commit 13c5ad58ec

View File

@ -36,6 +36,22 @@ if($remote) {
$image = $imagename
}
$response = Read-Host "Do you want to bind the container home directory into a windows directory? [N/y]"
$additionaloptions = ''
if ($response -eq 'y') {
$directory = Read-Host "Write the windows directory destination relative to WSL, for example `"/mnt/c/Users/Username/Desktop/ExampleFolder`"`n"
mkdir -Force $directory | Out-Null
$additionaloptions = "-v ${directory}:/home/designer"
}
$response = Read-Host -Prompt "Do you want to set additional arguments for the container instantiation? [N/y]"
if ($response -eq 'y') {
$response = Read-Host -Prompt "Write the additional arguments, for example -v <wsl_path>:<container_path>."
$additionaloptions = -join($additionaloptions, $response)
}
Write-Host ""
$dockercommand = ("docker run -d " +
@ -45,6 +61,7 @@ $dockercommand = ("docker run -d " +
"-e WAYLAND_DISPLAY=`$WAYLAND_DISPLAY " +
"-e DISPLAY=`$DISPLAY " +
"-e XDG_RUNTIME_DIR=/mnt/wslg " +
"$additionaloptions "+
$image)
wsl -d Ubuntu bash -ic $dockercommand