OS: CentOS6.4docker
#uname -rvim
2.6.32-504.1.3.el6.x86_64bash
安裝完畢fig,並完成相應配置時執行以下命令出錯(fig安裝參見:http://www.fig.sh/):網絡
#fig up
Couldn't connect to Docker daemon at http+unix://var/run/docker.sock - is it running? If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
查詢相關網絡資料,只有關於CentOS7的解決方案。app
因而查看docker的啓動腳本:vim /etc/rc.d/init.d/docker,在第50行能夠看到啓動docker時執行的命令以下:$exec -d $other_args $DOCKER_STORAGE_OPTIONS &>> $logfile & tcp
從執行命令能夠看出,能夠帶一些自定義參數,如:$other_args $DOCKER_STORAGE_OPTIONS。spa
爲了解決目前遇到的問題,須要設置參數$other_args:.net
vim /etc/sysconfig/docker-storage # /etc/sysconfig/docker # # Other arguments to pass to the docker daemon process # These will be parsed by the sysv initscript and appended # to the arguments list passed to docker -d other_args="-H tcp://127.0.0.1:4243 -H unix:///var/run/docker.sock"
重啓docker 服務並查看docker服務是否監聽了4243端口:unix
#service docker restart
#netstat -anpt | grep 4243
tcp 0 0 127.0.0.1:4243 0.0.0.0:* LISTEN 7760/docker
同時須要設置環境變量$DOCKER_HOST:rest
$vim ~/.bashrc export DOCKER_HOST=tcp://localhost:4243
在執行fig up時已經ok。
參考:
Ubuntu上的解決辦法:http://blog.csdn.net/kongxx/article/details/43481573#comments
CentOS7上的解決辦法:https://docs.docker.com/articles/systemd/