调整国内使用docker的姿势

因为国内网络的原因

install dependencies

yum install epel-release -y yum install gcc gettext autoconf libtool automake make pcre-devel asciidoc xmlto udns-devel libev-devel -y

install shadowsocks-libev

cd /etc/yum.repos.d/ wget https://copr.fedoraproject.org/coprs/librehat/shadowsocks/repo/epel-7/librehat-shadowsocks-epel-7.repo yum update yum install shadowsocks-libev

edit config.json

vi /etc/shadowsocks-libev/ss-local.config.json
{
"server": "41.72.15.246",
"server_port": 1910,
"local_address": "127.0.0.1",
"local_port": 1088,
"password": "123456ss",
"timeout": 600,
"method": "rc4-md5"
}

启用socks5代理服务

ss-local -c /etc/shadowsocks.json

修改docker代理配置

cd /usr/lib/systemd/system/
mkdir docker.service.d
cd docker.service.d vim https-proxy.conf

内容如下

[Service] Environment="ALL_PROXY=socks5://localhost:1088"

允许docker远程访问

vim remote_port.conf

内容如下

[Service] ExecStart= ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock