boot2docker格式错误的HTTP状态代码“/v1.15/containers/json”

时间:2014-10-22 19:07:34

标签: docker boot2docker

尝试用brew重新安装boot2docker,但遇到了同样的问题。下面是我运行的命令的屏幕抓取。任何人都知道什么是错的?

==> Checking out tag v1.3.0
==> go get -d
==> make goinstall
  /usr/local/Cellar/boot2docker/1.3.0: 2 files, 7.2M, built in 3 seconds


~ » boot2docker init                                                                                   wg@wg-MacBook-Pro
------------------------------------------------------------
~ » boot2docker up                             
wg@wg-MacBook-Pro
Waiting for VM and Docker daemon to start...
.....................ooooooooooooooooo
Started.
Writing /Users/wg/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/wg/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/wg/.boot2docker/certs/boot2docker-vm/key.pem

To connect the Docker client to the Docker daemon, please set:
    export DOCKER_CERT_PATH=/Users/wg/.boot2docker/certs/boot2docker-vm
    export DOCKER_TLS_VERIFY=1

------------------------------------------------------------
~ » export DOCKER_CERT_PATH=/Users/wgillmer/.boot2docker/certs/boot2docker-vm 
wg@wg-MacBook-Pro
------------------------------------------------------------
~ » export DOCKER_TLS_VERIFY=1
wg@wg-MacBook-Pro
------------------------------------------------------------
~ » docker ps
wg@wg-MacBook-Pro
Password:
2014/10/22 20:52:08 Get http:///var/run/docker.sock/v1.15/containers/json: malformed HTTP status code "/v1.15/containers/json"
------------------------------------------------------------
~ »

删除我的.boot2docker目录并重新运行init以获得新的下载,然后up似乎会产生相同的结果。

~ » boot2docker destroy 
wg@wg-MacBook-Pro
------------------------------------------------------------
~ » rm -Rfv ./.boot2docker
 wg@wg-MacBook-Pro
./.boot2docker/boot2docker.iso
./.boot2docker/certs/boot2docker-vm/ca.pem
./.boot2docker/certs/boot2docker-vm/cert.pem
./.boot2docker/certs/boot2docker-vm/key.pem
./.boot2docker/certs/boot2docker-vm
./.boot2docker/certs
./.boot2docker
------------------------------------------------------------
~ » boot2docker init 
wg@wg-MacBook-Pro
Latest release for boot2docker/boot2docker is v1.3.0
Downloading boot2docker ISO image...
Success: downloaded 

https://github.com/boot2docker/boot2docker/releases/download/v1.3.0/boot2docker.iso
    to /Users/wg/.boot2docker/boot2docker.iso
------------------------------------------------------------
~ » boot2docker up 
wg@wg-MacBook-Pro
Waiting for VM and Docker daemon to start...
.....................ooooooooooooooooo
Started.
Writing /Users/wg/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/wg/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/wg/.boot2docker/certs/boot2docker-vm/key.pem
Your environment variables are already set correctly.

------------------------------------------------------------
~ » docker ps 
wg@wg-MacBook-Pro
Password:
2014/10/22 21:04:20 Get http:///var/run/docker.sock/v1.15/containers/json: malformed 
HTTP status code "/v1.15/containers/json"
------------------------------------------------------------
~ »

2 个答案:

答案 0 :(得分:3)

我了解到,如果你不将这些添加到你的shell的rc文件中,它可能导致docker客户端吐出格式错误的json错误消息:

export DOCKER_CERT_PATH=/Users/sindhus/.boot2docker/certs/boot2docker-vm export DOCKER_TLS_VERIFY=1

我错误地只是添加export DOCKER_HOST=tcp://192.168.59.104:2376并试图运行docker ps等命令。

希望这有帮助!

答案 1 :(得分:2)

为什么docker ps会要求您输入密码?

看起来docker可能会为sudo docker设置别名(或者您实际上正在运行sudo docker ps),这意味着您的泊坞窗环境变量未正确设置。

有关完整说明,请参阅this answer