从私有镜像库pull的时候报错:Error response from daemon: invalid registry endpoint https:/……

Docker 1.7解决办法
setp 1 配置DOCKER_OPTS参数

[root@123 ] # vi /etc/sysconfig/docker
other_args=
DOCKER_CERT_PATH=/etc/docker

add

DOCKER_OPTS="--insecure-registry ip:port"

save之后
setp 2 修改启动项

[root@123 ] # vi /etc/init.d/docker

找到 start 函数,在exec处增加 刚配置的DOCKER_OPTS,参见下边空行处

start() {
if [ ! -x $exec ]; then
if [ ! -e $exec ]; then
echo "Docker executable $exec not found"
else
echo "You do not have permission to execute the Docker executable $exec"
fi
exit 5
fi

check_for_cleanup

if ! [ -f $pidfile ]; then
    prestart
    printf "Starting $prog:\t"
    echo "\n$(date)\n" >> $logfile

    ## add DOCKER_OPTS
    $exec -d $DOCKER_OPTS &>> $logfile &

    pid=$!
    touch $lockfile

    tries=0
    while [ ! -f $pidfile -a $tries -lt 10 ]; do
        sleep 1
        tries=$((tries + 1))
    done
    success
    echo
else
    failure
    echo
    printf "$pidfile still exists...\n"
    exit 7
fi

}

setp 3 重启docker

[root@123 ] # service docker restart

setp 4 验证是否可以pull
Another way

不这么费事,直接修改启动项,原理和结果都是相同的

[root@123 ] # vi /etc/init.d/docker

找到exec,直接添加--insecure-registry ip:port

prog="docker"
exec="/usr/bin/$prog --insecure-registry ip:port"
pidfile="/var/run/$prog.pid"
lockfile="/var/lock/subsys/$prog"
logfile="/var/log/$prog"

然后重启docker daemon