繁体   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