問題描述
從 Windows 10 的 wsl 將捲設置為 docker 容器 (Set volume to docker container from wsl from windows 10)
但不要在主機內創建此目錄,如您所見:</p>
PS D:\wsl\data> dir
Directory: D:\wsl\data
Mode LastWriteTime Length Name
‑‑‑‑ ‑‑‑‑‑‑‑‑‑‑‑‑‑ ‑‑‑‑‑‑ ‑‑‑‑
‑a‑‑‑‑ 8/31/2019 2:27 PM 0 New Text Document.txt
PS D:\wsl\data>
/var/lib/postgresql/data/data/
在哪裡?為什麼它沒有出現在 /mnt/d/wsl/data 中?
參考解法
方法 1:
You must move your mounting path from /mnt to /. In this answer there is the following explanation : Can you run Docker natively on the new Windows 10 (Ubuntu) bash userspace?
Volumes
Take care when adding volumes. The path C:\dir
will be visible as /mnt/c/dir
on WSL and as /c/dir/
by docker engine. You can overcome it permanently:
sudo bash ‑c "echo ‑e '[automount] \nroot = /'>/etc/wsl.conf"
You must exit and reload WSL after making the change to wsl.conf so that WSL reads in your changes on launch.
Regards
(by Cyrus the Great、Carlos Rafael Ramirez)