從 Windows 10 的 wsl 將捲設置為 docker 容器 (Set volume to docker container from wsl from windows 10)


問題描述

從 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 GreatCarlos Rafael Ramirez)

參考文件

  1. Set volume to docker container from wsl from windows 10 (CC BY‑SA 2.5/3.0/4.0)

#windows-subsystem-for-linux #docker






相關問題

Windows 10 中“Bash on Ubuntu on Windows”的 .bashrc 位置 (Location of .bashrc for "Bash on Ubuntu on Windows" in Windows 10)

無法在 WSL Ubuntu 18.04 上安裝 R Shiny Server (Cannot install R Shiny Server on WSL Ubuntu 18.04)

從 Windows 10 的 wsl 將捲設置為 docker 容器 (Set volume to docker container from wsl from windows 10)

npm 錯誤!使用 wsl 將 npm 模塊安裝到 Windows 10 時出現錯誤 -13 (npm ERR! errno -13 when Installing npm module to windows 10 with wsl)

如何使用 WSL 訪問 Odoo 12 (How to access Odoo 12 using WSL)

用 recorder.js 錄製語音並將其上傳到 python-flask 服務器,但 WAV 文件已損壞 (Record voice with recorder.js and upload it to python-flask server, but WAV file is broken)

無法將 WSL 節點解釋器添加到 WebStorm (Can't add WSL Node Interpreter to WebStorm)

即使我通過瀏覽器下載了最新的穩定版本,為什麼我的 ubuntu 終端 v10 中的節點版本仍然存在? (Why is my node version in my ubuntu terminal v10 even though I downloaded the latest stable version through browser?)

帶有 python 子進程的 WSL (WSL with python subprocess)

在 Powershell 中重定向 WSL 輸入 (Redirect WSL input in Powershell)

VSCode WSL奇怪的顏色問題 (VSCode WSL Weird Colors Issue)

FAT[0000] 無效配置:未提供配置 (FATA[0000] invalid configuration: no configuration has been provided)







留言討論