在OS X 上安装docker时遇到的一个错误

先在这里(需翻墙)下载最新的版本的Docker for OS X Installer,现在最新版本是1.6.2 装好之后应用程序中会有boot2docker和VirtualBox两个应用程序,/usr/local/bin/目录下也会有docker和boot2docker两个命令。 打开boot2docker应用程序会直接抛出一个终端并执行一些初始化命令,在执行到boot2docker up时遇到一个错误“  Trying to get Docker socket one more time Error requesting socket: exit status 255 Auto detection of the VM’s Docker socket failed.”。 初学docker,也没什么头绪,只能搜索一番,终于在stack overflow上找到了答案,原因很简单,在/etc/hosts文件里必须有”127.0.0.1       localhost”一行记录,没有的话就会出现这个错误,但是在官方文档中并没有这个提示。 重新打开boot2docker,配置初始化完成

bash
Last login: Thu Jun 11 15:51:24 on ttys009
localhost:~ cescwu$ bash
bash-3.2$ unset DYLD_LIBRARY_PATH ; unset LD_LIBRARY_PATH
bash-3.2$ mkdir -p ~/.boot2docker
if [ ! -f ~/.boot2docker/boot2docker.iso ]; then cp /usr/local/share/boot2docker/boot2docker.iso ~/.boot2docker/ ; fi
/usr/local/bin/boot2docker init 
/usr/local/bin/boot2docker up 
$(/usr/local/bin/boot2docker shellinit)
docker version
bash-3.2$ if [ ! -f ~/.boot2docker/boot2docker.iso ]; then cp /usr/local/share/boot2docker/boot2docker.iso ~/.boot2docker/ ; fi
bash-3.2$ /usr/local/bin/boot2docker init 
Virtual machine boot2docker-vm already exists
bash-3.2$ /usr/local/bin/boot2docker up 
Waiting for VM and Docker daemon to start...
.o
Started.
Writing /Users/cescwu/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/cescwu/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/cescwu/.boot2docker/certs/boot2docker-vm/key.pem

To connect the Docker client to the Docker daemon, please set:
    export DOCKER_HOST=tcp://192.168.59.103:2376
    export DOCKER_CERT_PATH=/Users/cescwu/.boot2docker/certs/boot2docker-vm
    export DOCKER_TLS_VERIFY=1

bash-3.2$ $(/usr/local/bin/boot2docker shellinit)
Writing /Users/cescwu/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/cescwu/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/cescwu/.boot2docker/certs/boot2docker-vm/key.pem
bash-3.2$ docker version
Client version: 1.6.2
Client API version: 1.18
Go version (client): go1.4.2
Git commit (client): 7c8fca2
OS/Arch (client): darwin/amd64
Server version: 1.6.2
Server API version: 1.18
Go version (server): go1.4.2
Git commit (server): 7c8fca2
OS/Arch (server): linux/amd64

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注