正在免費(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/2 S+ 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/2 S+ 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
更多建議: