Created
September 26, 2016 18:40
-
-
Save atoa/be0a816eba19ad7550928d9665ce3c56 to your computer and use it in GitHub Desktop.
mount drive on docker for windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$drive = $env:homedrive.Substring(0,1) | |
$ip = Get-NetIPConfiguration -InterfaceAlias "vEthernet (DockerNAT)" | Select IPv4Address | |
$unc = "//" + $ip.IPv4Address.IPAddress + "/" + $drive | |
[Environment]::SetEnvironmentVariable("UNC", $unc, "Process") | |
[Environment]::SetEnvironmentVariable("DRIVE", $drive, "Process") | |
docker run -ti --rm --privileged --pid=host -e USERNAME -e USERDOMAIN -e DRIVE -e UNC ubuntu nsenter --target 1 --mount --uts --ipc --net --pid sh -x -c ' | |
[ -d "/${DRIVE}" ] || mkdir "/${DRIVE}" && \ | |
mount.cifs "${UNC}" "/${DRIVE}" \ | |
-o "user=${USERNAME},domain=${USERDOMAIN},noperm,forceuid,mfsymlinks,file_mode=0700,dir_mode=0700,nobrl,vers=3.0" | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment