簡體   English   中英

在virtualbox的ubuntu上安裝docker,無法拉取映像

[英]docker installation on ubuntu in virtualbox, cannot pull images

我在Windows 10上運行的virtualbox 5.0.26中以訪客操作系統的形式安裝了ubuntu 14.04.5,我不知道ubuntu安裝是否存在任何問題,它似乎運行良好並且具有橋接互聯網連接,因此擁有自己的ip。

我已經按照docker docs for linux上的說明安裝了docker。 安裝正常,沒有任何錯誤,並且docker守護程序正常啟動。 這是碼頭工人信息:

root@ubuntu-z9:~# docker info
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 1.12.0
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 0
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: overlay bridge host null
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: apparmor
Kernel Version: 4.2.0-27-generic
Operating System: Ubuntu 14.04.5 LTS
OSType: linux
Architecture: x86_64
CPUs: 10
Total Memory: 31.42 GiB
Name: ubuntu-z9
ID: 7MPO:OHFW:3OBJ:KUVX:3YCS:XP4U:RE6W:SFC3:O4KK:GJJU:M6WJ:HYLY
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
WARNING: No swap limit support
Insecure Registries:
 127.0.0.0/8

機器可以正常上網並從瀏覽器訪問hub.docker.com。

但是,當我運行簡單的hello-world測試時,守護進程掛起

root@ubuntu-z9:~# docker run hello-world
Unable to find image 'hello-world:latest' locally

超時。

我可以在Windows 10主機上運行docker-machine而沒有任何問題,因此我認為問題出在我在virtualbox和docker中設置ubuntu機器上。

這是ubuntu來賓計算機上docker守護程序的日志輸出:

$ docker pull hello-world

DEBU[0093] Calling POST /v1.24/images/create?fromImage=hello-world&tag=latest 
DEBU[0093] Trying to pull hello-world from https://registry-1.docker.io v2 
DEBU[0094] Increasing token expiration to: 60 seconds   
ERRO[0494] Error trying v2 registry: error parsing HTTP 408 response body: invalid character '<' looking for beginning of value: "<html><body><h1>408 Request Time-out</h1>\nYour browser didn't send a complete request in time.\n</body></html>\n\n" 
ERRO[0494] Attempting next endpoint for pull after error: error parsing HTTP 408 response body: invalid character '<' looking for beginning of value: "<html><body><h1>408 Request Time-out</h1>\nYour browser didn't send a complete request in time.\n</body></html>\n\n" 
DEBU[0494] Skipping v1 endpoint https://index.docker.io because v2 registry was detected 
ERRO[0494] Handler for POST /v1.24/images/create returned error: error parsing HTTP 408 response body: invalid character '<' looking for beginning of value: "<html><body><h1>408 Request Time-out</h1>\nYour browser didn't send a complete request in time.\n</body></html>\n\n"

關於診斷或解決問題的方法有什么建議嗎?

非常感謝。

這是一個簡單的問題,毫無疑問地記錄在某處,但我錯過了。 如果其他人也有相同的問題,我會在這里發布答案。

virtualbox os(在我的情況下為ubuntu)必須具有NAT網絡適配器,並且NAT適配器的優先級必須高於網橋適配器(如果有的話)。 您不需要橋接適配器來運行docker(但是,如果您希望virtualbox在本地網絡上具有ip,那么您確實需要添加橋接適配器。)

VirtualBox的配置實例的工作運行泊塢窗:

  1. VBox適配器1:NAT(eth0),VBox適配器2:僅主機適配器(eth1)
  2. VBox適配器1:NAT(eth0),VBox適配器2:橋接適配器(eth1)

無法運行docker的VirtualBox配置示例:

  1. VBox適配器1:橋接適配器(eth0)
  2. VBox適配器1:橋接適配器(eth0),VBox適配器2:NAT(eth1)

請注意,在所有四種情況下,virtualbox ubuntu os都可以訪問互聯網,但是docker僅在NAT優先於橋接接口時才能拉映像。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM