简体   繁体   English

在 WSL2 for Jupyter 上与 docker 共享 Windows 文件夹

[英]Sharing Windows folder with docker on WSL2 for Jupyter

I currently try setting up my data-science environment with WSL2 using docker. So my goal is to store everything on windows, using windows Docker Desktop to run Jupyter within a container on WSL2.我目前尝试使用 docker 通过 WSL2 设置我的数据科学环境。所以我的目标是将所有内容存储在 windows 上,使用 windows Docker 桌面在 WSL2 上的容器中运行 Jupyter。 So I try to mount the c drive within my docker container with the following code executed on Powershell (not the Linux shell):所以我尝试在我的 docker 容器中安装 c 驱动器,并在 Powershell(不是 Linux shell)上执行以下代码:

docker run -v `pwd`:/mnt/c/Users/rener/ -p 8888:8888 minicondacontainer jupyter lab --ip='*' --port=8888 --allow-root --no-browser --NotebookApp.token='' --NotebookApp.notebook_dir='/mnt/c/Users/rener/'

It only binds a new working directory, but not my windows drive.它只绑定一个新的工作目录,但不绑定我的 windows 驱动器。 I would really appreciate any help!我真的很感激任何帮助!

Thanks!谢谢!

I kinda misunderstood "docker -v".我有点误解了“docker -v”。 My previous command only mounted the current working directory, which did not work, because the PowerShell working directory is windows, while docker is being executed within WSL.我之前的命令只挂载了当前的工作目录,没有起作用,因为PowerShell的工作目录是windows,而docker是在WSL内部执行的。 The following solved it:以下解决了它:

docker run -v /c/Users/rener/:/host/ -p 8888:8888 minicondacontainer jupyter lab --ip='*' --port=8888 --allow-root --no-browser --NotebookApp.token=''

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM