调整国内使用docker的姿势

因为国内网络的原因

install dependencies

1
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

1
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

1
vi /etc/shadowsocks-libev/ss-local.config.json
1
2
3
4
5
6
7
8
9
{
"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代理服务

1
ss-local -c /etc/shadowsocks.json

修改docker代理配置

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

内容如下

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

允许docker远程访问

1
vim remote_port.conf

内容如下

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