2016-04-29 106 views
4

我運行Ubuntu安裝以下軟件泊塢窗:泊塢窗:無法連接到碼頭工人守護

$ docker version 
Client: 
Version:  1.9.1 
API version: 1.21 
Go version: go1.4.3 
Git commit: a34a1d5 
Built:  Fri Nov 20 17:56:04 UTC 2015 
OS/Arch:  linux/amd64 
Cannot connect to the Docker daemon. Is the docker daemon running on this host? 

$ docker-compose -v 
docker-compose version 1.7.0, build 0d7bf73 

當試圖運行搬運工,撰寫我收到以下錯誤:

$ sudo docker-compose up 
ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running? 

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable. 

我試過以下內容:

systemctl unmask docker.service 
systemctl unmask docker.socket 
systemctl start docker.service 

sudo service docker status 
● docker.service - Docker Application Container Engine 
    Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled) 
    Active: active (running) since Fri 2016-04-29 13:36:57 CEST; 4min 3s ago 
    Docs: https://docs.docker.com 
Main PID: 6394 (docker) 
    Memory: 13.3M 
     CPU: 119ms 
    CGroup: /system.slice/docker.service 
      └─6394 /usr/bin/docker daemon -H fd:// 

Apr 29 13:36:57 Charles docker[6394]: time="2016-04-29T13:36:57.722083467+02:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon opt...d IP address" 
Apr 29 13:36:57 Charles docker[6394]: time="2016-04-29T13:36:57.805189862+02:00" level=warning msg="Your kernel does not support swap memory limit." 
Apr 29 13:36:57 Charles docker[6394]: time="2016-04-29T13:36:57.827955299+02:00" level=info msg="Loading containers: start." 
Apr 29 13:36:57 Charles docker[6394]: time="2016-04-29T13:36:57.828083895+02:00" level=info msg="Loading containers: done." 
Apr 29 13:36:57 Charles docker[6394]: time="2016-04-29T13:36:57.828095512+02:00" level=info msg="Daemon has completed initialization" 
Apr 29 13:36:57 Charles docker[6394]: time="2016-04-29T13:36:57.828125198+02:00" level=info msg="Docker daemon" commit=a34a1d5 execdriver=native-0.2 graphdriver=aufs version=1.9.1 
Apr 29 13:36:57 Charles systemd[1]: Started Docker Application Container Engine. 
Apr 29 13:37:10 Charles systemd[1]: Started Docker Application Container Engine. 
Apr 29 13:37:34 Charles systemd[1]: Started Docker Application Container Engine. 
Apr 29 13:38:01 Charles systemd[1]: Started Docker Application Container Engine. 
Hint: Some lines were ellipsized, use -l to show in full. 
[email protected]:~/Documents/software/deliverable$ docker ps 
Cannot connect to the Docker daemon. Is the docker daemon running on this host? 

Sudo?

當我運行使用sudo泊塢窗似乎運行:

$ sudo docker ps 
CONTAINER ID  IMAGE    COMMAND    CREATED    STATUS    PORTS    NAMES 
$ docker ps 
Cannot connect to the Docker daemon. Is the docker daemon running on this host? 

我該如何解決這個問題?

+0

是泊塢窗守護確實運行?當你執行'docker version'時,你會得到什麼(它也列出了守護進程版本,即比'docker -v'更多的細節)? – Rick

+0

你可以驗證使用'systemctl'或者其他服務管理器嗎? – Rick

+0

似乎是這樣,使得這是一個副本http://stackoverflow.com/q/33562109/2137833 – Rick

回答

0

看一看這個thread。它似乎處理同樣的問題。

答:

The Docker machine is running. But you need to export some environment to connect to the Docker machine. By default, the docker CLI client is trying to communicate to the daemon using http+unix://var/run/docker.sock (as shown in the error message).

Export the correct environment variables using eval $(docker-machine env dev) and then try again. You can also just run docker-machine env dev to see the environment variables it will export. Notice that one of them is DOCKER_HOST, just as the error message suggests you may need to set.

+0

我沒有碼頭機安裝。我需要安裝機器嗎? – Magick

+1

Docker Machine只是一個用於管理多個docker實例的工具。你不一定需要它,但顯然它正在鏈接的線程中使用。 – Rick

+2

嘗試與sudo,那爲我工作.. – Viraths

相關問題