在適用於 Linux 的 Windows 子系統上安裝後無法存取 Docker

在適用於 Linux 的 Windows 子系統上安裝後無法存取 Docker

我已經使用適用於 Linux 的 Windows 子系統安裝了 Docker:

peter@BRIAN-PC:/mnt/c/Windows/System32$ docker version
The program 'docker' is currently not installed. You can install it by typing:
sudo apt-get install docker
peter@BRIAN-PC:/mnt/c/Windows/System32$ sudo apt-get install docker
[sudo] password for peter:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libfreetype6 os-prober
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed
  docker
0 to upgrade, 1 to newly install, 0 to remove and 50 not to upgrade.
Need to get 12.2 kB of archives.
After this operation, 65.5 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu/ trusty-updates/universe docker amd64 1.5-1 [12.2 kB]
Fetched 12.2 kB in 0s (48.5 kB/s)
Selecting previously unselected package docker.
(Reading database ... 25663 files and directories currently installed.)
Preparing to unpack .../docker_1.5-1_amd64.deb ...
Unpacking docker (1.5-1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up docker (1.5-1) ...
peter@BRIAN-PC:/mnt/c/Windows/System32$ docker version
The program 'docker' is currently not installed. You can install it by typing:
sudo apt-get install docker

顯然我已經輸入了sudo apt-get install docker。有人能告訴我如何讓它發揮作用嗎?我嘗試在純 Windows 上安裝,但出現不同的錯誤。不幸的是,我目前無法存取完全運行的 Linux 機器。

答案1

該包名為docker在 Ubuntu(如 Debian 和其他幾個發行版)上不是碼頭工人,Linux容器部署工具,但是碼頭工人,Gnome 和 KDE 的系統托盤。現在容器管理工具比較有名,但是系統托盤以前就存在,而且還是有包名的。容器管理工具位於一個名為docker.io

您可以透過使用以下工具探索軟體包來找到這一點apt

apt show docker               # or apt-cache show docker
apt search docker             # or apt-cache search docker
sudo apt install docker.io    # or sudo apt-get install docker.io

在 trusty (Ubuntu 14.04) 上,容器管理工具的可執行檔最初名為docker.io,然後在更新中變更為docker,系統托盤可執行檔更名為wmdocker。看起來您系統的“未找到命令”資料庫是根據原始名稱構建的,並且其快取已過期。要重建緩存,請運行update-command-not-found.使用最新的緩存,命令的順序將是一致的 - 在原始的 Ubuntu 14.04 上,您將成功安裝系統托盤,而在更新的版本上,該訊息將告訴您安裝docker.io.


由於您使用的是適用於 Linux 的 Windows 子系統,而不是實際的 Linux,因此讓 Docker 運作不僅僅是安裝軟體套件的問題。 Docker 依賴一些 Windows 無法模擬的 Linux 功能。有一個適用於 Windows 的 Docker,這是具有相同介面的不同程式;這個伺服器故障帖子解釋如何讓它運行。但如果你想要真正的 Docker,你需要運行真正的 Linux,而不是昂貴的塑膠仿製品。 「我目前無法存取完全運行的 Linux 機器」可以透過在虛擬機器中安裝 Linux 在幾分鐘內解決。

相關內容