鍍金池/ 教程/ Linux/ Docker 實(shí)踐 6:Cannot connect to the Docker daemon.
Docker 實(shí)踐 3:fig 搭建 mediawiki
Docker 實(shí)踐 9:備份方案
Docker 實(shí)踐
Docker 實(shí)踐 2:用 Docker 搭建 hg-server
Docker 實(shí)踐 7:容器與主機(jī)拷貝數(shù)據(jù)
Docker 實(shí)踐 6:Cannot connect to the Docker daemon.
Docker 實(shí)踐 5:搭建 redmine
Docker 實(shí)踐 4:搭建 wordpress
Docker 實(shí)踐 8:Compose

Docker 實(shí)踐 6:Cannot connect to the Docker daemon.

正在免費(fèi)適用著 Aliyun 主機(jī),當(dāng)然要用 docker 來(lái)部署我的服務(wù)器啦。但是今天碰到了題目的問(wèn)題,細(xì)節(jié)如下:


    # docker info
    FATA[0000] Cannot connect to the Docker daemon. Is 'docker -d' running on this host? 
    # docker -d
    INFO[0000] +job serveapi(unix:///var/run/docker.sock)   
    FATA[0000] pid file found, ensure docker is not running or delete /var/run/docker.pid 

首先要查看 docker daemon 是否在運(yùn)行。


    # ps aux | grep docker
    root   691  0.0  1.6 506388 17068 ?Ssl  Mar07   0:45 /usr/bin/docker -d
    root  1330  0.0  0.8 124088  8392 ?Sl   Mar07   0:01 docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 80 -container-ip 192.168.42.2 -container-port 80
    root  9607  0.0  0.0  11720   896 pts/2S+   16:50   0:00 grep --color=auto docker

這樣看來(lái),docker deamon 正在運(yùn)行,但是報(bào)此錯(cuò)誤實(shí)屬不應(yīng)該。那么將其停止,再啟動(dòng)。


    # service docker stop
    # ps aux | grep docker
    root  9624  0.0  0.0  11716   636 pts/2S+   16:52   0:00 grep --color=auto docker
    # docker -d
    INFO[0000] +job serveapi(unix:///var/run/docker.sock)   
    INFO[0000] Listening for HTTP on unix (/var/run/docker.sock) 
    INFO[0000] +job init_networkdriver()
    INFO[0000] -job init_networkdriver() = OK (0)   
    INFO[0000] WARNING: Your kernel does not support cgroup swap limit. 
    INFO[0000] Loading containers: start.   
    ..........
    INFO[0001] Loading containers: done.
    INFO[0001] docker daemon: 1.5.0 a8a31ef; execdriver: native-0.2; graphdriver: aufs 
    INFO[0001] +job acceptconnections() 
    INFO[0001] -job acceptconnections() = OK (0)  

好吧,最有趣的事情是,之前我在 root下一切運(yùn)行良好,但是現(xiàn)在就像見(jiàn)鬼一樣遇到上面的問(wèn)題。上述的工作完成后,仍有問(wèn)題。最后我使用 sudo 竟然解決了問(wèn)題。如下:


    # sudo docker info
    Containers: 5
    Images: 32
    Storage Driver: aufs
     Root Dir: /var/lib/docker/aufs
     Backing Filesystem: extfs
     Dirs: 42
    Execution Driver: native-0.2
    Kernel Version: 3.13.0-32-generic
    Operating System: Ubuntu 14.04.1 LTS

版權(quán)聲明:本文為博主原創(chuàng)文章,未經(jīng)博主允許不得轉(zhuǎn)載。