Can't run docker on os X with boot2docker

2019-07-14 03:13发布

I've tried to remove docker with this manual.

And I removed virtualbox. And then tried to install boot2docker.

After boot2docker init etc (by the manual on docker site)

docker run helloworld

gives me this error

Cannot connect to the Docker daemon. Is 'docker -d' running on this host?

boot2docker status
running

docker version
Client version: 1.7.0
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 0baf609
OS/Arch (client): darwin/amd64
Cannot connect to the Docker daemon. Is 'docker -d' running on this host?

3条回答
对你真心纯属浪费
2楼-- · 2019-07-14 03:51

You need to run boot2docker up then docker run helloworld.

查看更多
唯我独甜
3楼-- · 2019-07-14 03:54

Maybe the daemon is not running?

Damiens-MacBook-Air:tmp damien$ docker version
Client version: 1.7.0
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 0baf609
OS/Arch (client): darwin/amd64
Cannot connect to the Docker daemon. Is 'docker -d' running on this host?

... check if the daemon is running :

Damiens-MacBook-Air:tmp damien$ boot2docker ssh sudo /etc/init.d/docker status
Docker daemon is not running
error in run: exit status 1

then start it :

Damiens-MacBook-Air:tmp damien$ boot2docker ssh sudo /etc/init.d/docker start
Need TLS certs for boot2docker,127.0.0.1,10.0.2.15,192.168.59.103
-------------------

and now you should be able to connect.

Damiens-MacBook-Air:tmp damien$ docker version
Client version: 1.7.0
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 0baf609
OS/Arch (client): darwin/amd64
Server version: 1.7.0
Server API version: 1.19
Go version (server): go1.4.2
Git commit (server): 0baf609
OS/Arch (server): linux/amd64
查看更多
何必那么认真
4楼-- · 2019-07-14 03:57

Boot2docker is not the recommended way of using Docker (on Windows/OS X) anymore (IMHO).

See Docker Machine instead (which can use the "boot2docker iso" internally, but not only).

You may also want to import your existing boot2docker environment (to keep your built images, etc.), it's possible too.

Then using Docker Machine, you can create a working Docker environment with the following commands:

On OS X (or an OS which supports eval and export commands), if you have the Docker CLI installed:

docker-machine create -d virtualbox dev
eval "$(docker-machine env dev)"
docker run hello-world

OR

On any OS, if you have not the Docker CLI installed:

docker-machine create -d virtualbox dev
docker-machine ssh dev
docker run hello-world
查看更多
登录 后发表回答