wsl1中可以嘗試這樣mount
docker run --rm -it --privileged \
--mount type=bind,source=/mnt,target=/mnt \
--mount type=bind,source=/run/WSL,target=/run/WSL \
--mount type=bind,source=/etc/passwd,target=/etc/passwd,readonly \
--mount type=bind,source=/etc/group,target=/etc/group,readonly \
--mount "type=bind,source=$HOME,target=$HOME" \
--workdir "$HOME" \
-u $(id -u):$(id -g) \
--env WSLENV="${WSLENV}" \
--env WSL_DISTRO_NAME="${WSL_DISTRO_NAME}" \
--env WSL_INTEROP="${WSL_INTEROP}" \
--env WT_PROFILE_ID="${WT_PROFILE_ID}" \
--env WT_SESSION="${WT_SESSION}" \
ubuntu \
sh -c '/mnt/c/Windows/system32/notepad.exe'
wsl2中嘗試這樣mount
docker run --rm -it --privileged \
--mount type=bind,source=/init,target=/init \
--mount type=bind,source=/mnt,target=/mnt \
--mount type=bind,source=/run/WSL,target=/run/WSL \
--env WSL2_GUI_APPS_ENABLED="${WSL2_GUI_APPS_ENABLED}" \
--env WSL_INTEROP="${WSL_INTEROP}" \
--env PULSE_SERVER="${PULSE_SERVER}" \
ubuntu \
bash -c '"/mnt/c/Support Files/notepad.exe"'
在wsl的docker中調用windows下程序
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。
推薦閱讀更多精彩內容
- 最近因為python爬蟲學習要借助Splash進行js渲染服務,Splash又要使用到Docker,而我卻沒有li...
- 參考:https://github.com/Microsoft/WSL/issues/2468 Presuming...
- 參考: Win10內置Ubuntu,完美使用Docker in Windows 現在Win10下用WSL(Wind...
- 文章原發表于我的博客 5+1Blog 516wjy.xyz:516[https://516wjy.xyz:516/...