一、發現問題
樓主不管輸入那個命令,都出現了:
FATA[0000] Cannot connect to the Docker daemon. Is 'docker -d' running on this host?
二、解決方法
以及類似的錯誤,就連docker version
命令都報錯了,樓主開始找啊找,找到了好多東西,結果發現沒一個能行的,最后樓主使用這樣的命令:
# vim /etc/default/docker
在該文件中添加如下內容:
DOCKER_OPTS="-H unix:///var/run/docker.sock -H 0.0.0.0:5555"
# service docker restart
這樣就行了..我也不知道怎么樣就行了.真的好神奇.
樓主趕快使用了一下
syx@syx-VB:~$ docker version Client version: 1.6.2 Client API version: 1.18 Go version (client): go1.3.3 Git commit (client): 7c8fca2 OS/Arch (client): linux/amd64 Server version: 1.6.2 Server API version: 1.18 Go version (server): go1.3.3 Git commit (server): 7c8fca2 OS/Arch (server): linux/amd64
好神奇,終于可以了,樓主趕快把docker升級到最新版本.
$ sudo add-apt-repository ppa:docker-maint/testing $ sudo apt-get update $ sudo apt-get install docker.io
樓主這樣就行了一次,然后就又不行了樓主開始找原因,這次樓主問了問別了,別人說在ubuntu下安裝一個devicemapper
樓主使用的命令如下:
root@syx-VB:~# apt-get install -y libdevmapper-dev
還是不行啊
root@syx-VB:~# service docker restart root@syx-VB:~# docker version root@syx-VB:~# docker version Client version: 1.7.0-dev Client API version: 1.19 Go version (client): go1.4.2 Git commit (client): 9234460 OS/Arch (client): linux/amd64 FATA[0000] Get http:///var/run/docker.sock/v1.19/version: read unix /var/run/docker.sock: connection reset by peer. Are you trying to connect to a TLS-enabled daemon without TLS?
樓主英語不行,看不懂是啥意思,接著問.
人家告訴樓主使用docker -d
來看看:
root@syx-VB:~# docker -d INFO[0000] Listening for HTTP on unix (/var/run/docker.sock) FATA[0000] Error starting daemon: error initializing graphdriver: "/var/lib/docker" contains other graphdrivers: devicemapper; Please cleanup or explicitly choose storage driver (-s <DRIVER>)
看不懂,接著問大神!!!
大神說了把/var/lib/docker下的devicemapper清掉,樓主一看:
root@syx-VB:/var/lib/docker# ls aufs containers devicemapper graph init linkgraph.db repositories-aufs repositories-devicemapper tmp trust volumes
還真有這個目錄,于是使用:
root@syx-VB:/var/lib/docker# rm -r devicemapper/
接著:
root@syx-VB:/var/lib/docker# docker version Client version: 1.7.0-dev Client API version: 1.19 Go version (client): go1.4.2 Git commit (client): 9234460 OS/Arch (client): linux/amd64 FATA[0000] Cannot connect to the Docker daemon. Is 'docker -d' running on this host?
怎么還是不行!!
這個時候樓主重啟了一下docker服務,居然就好了。
root@syx-VB:/var/lib/docker# service docker restart root@syx-VB:/var/lib/docker# docker version
總結
好了,終于解決了,以上就是這篇文章的全部內容了,希望本文的內容對大家的學習或者工作能有所幫助,如果有疑問大家可以留言交流。
新聞熱點
疑難解答
圖片精選