为什么我不能在Mac OSX上运行Docker?

时间:2017-07-15 18:52:40

标签: macos docker

我使用Homebrew在我的Mac OSX机器(El-Capitan)上安装了Docker。

但是当我尝试运行它时,它会给我下面显示的错误。

$ docker --version
Docker version 17.06.0-ce, build 02c1d87

$ docker-compose --version
docker-compose version 1.14.0, build unknown

$ docker-machine --version
docker-machine version 0.12.2, build 9371605 

$ docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. 
Is the docker daemon running?

我该如何解决?

2 个答案:

答案 0 :(得分:1)

看起来你需要先启动Docker守护进程。查看brew info docker-machine的警告部分。

$ brew info docker-machine
docker-machine: stable 0.12.2 (bottled), HEAD
Create Docker hosts locally and on cloud providers
https://docs.docker.com/machine
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/docker-machine.rb
==> Dependencies
Build: go ✔, automake ✔
==> Requirements
Build: git ✔
==> Caveats
To have launchd start docker-machine now and restart at login:
  brew services start docker-machine
Or, if you don't want/need a background service you can just run:
  docker-machine start

答案 1 :(得分:0)

无需卸载docker,我也遇到了这一障碍,在Mac上,请按照以下步骤操作

  • 转到应用程序文件夹,然后单击docker图标
  • 等待它开始
  • 泊坞窗启动后,您可以运行任何泊坞窗命令而不会出现任何问题