zoukankan      html  css  js  c++  java
  • 解决CentOS6.4 Docker "Couldn't connect to Docker daemon ..." 问题

    OS: CentOS6.4

    #uname -r

    2.6.32-504.1.3.el6.x86_64

    安装完毕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的解决方案。

    于是查看docker的启动脚本:vim /etc/rc.d/init.d/docker,在第50行可以看到启动docker时执行的命令如下:$exec -d $other_args $DOCKER_STORAGE_OPTIONS &>> $logfile &  

    从执行命令可以看出,可以带一些自定义参数,如:$other_args $DOCKER_STORAGE_OPTIONS

    为了解决目前遇到的问题,需要设置参数$other_args

    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端口:

    #service docker restart
    #netstat -anpt | grep 4243
    tcp        0      0 127.0.0.1:4243              0.0.0.0:*                   LISTEN      7760/docker  

    同时需要设置环境变量$DOCKER_HOST:

    $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/

  • 相关阅读:
    I2C总线之(三)---以C语言理解IIC
    /sys/class/gpio 文件接口操作IO端口(s3c2440)
    CSP-201503
    CSP-201409
    CSP-201412
    Linux命令行学习笔记
    sstream
    VECTOR
    CSP-201403
    CSP-201312
  • 原文地址:https://www.cnblogs.com/nuccch/p/4280071.html
Copyright © 2011-2022 走看看