更换国内源
创建或修改 /etc/docker/daemon.json 文件,修改:
javascript
{
"registry-mirrors" : [
"https://registry.docker-cn.com",
"http://hub-mirror.c.163.com",
"https://docker.mirrors.ustc.edu.cn",
"https://cr.console.aliyun.com",
"https://mirror.ccs.tencentyun.com"
]
}
下面是一些国内镜像源:
javascript
Docker中国区官方镜像:
https://registry.docker-cn.com
网易:
http://hub-mirror.c.163.com
ustc:
https://docker.mirrors.ustc.edu.cn
中国科技大学:
https://docker.mirrors.ustc.edu.cn
阿里云:
https://cr.console.aliyun.com/
腾讯云:
https://mirror.ccs.tencentyun.com
重启docker服务使配置生效:
javascript
systemctl daemon-reload
systemctl restart docker.service
查看配置是否成功:
javascript
docker info
Registry Mirrors:有截图中框起来的就说明配置成功。
cl in docker
拉取cl镜像
javascript
docker pull dreamacro/clash
打开容器
javascript
docker ps -a
运行cl
config.yaml配置文件可以联系我获取,微信在文末:
javascript
docker run -d --name clash --restart always -p 7890:7890 -p 7891:7891 -p 9090:9090 -v /home/user/Desktop/xxx/config.yaml:/root/.config/clash/config.yaml dreamacro/clash
检查cl配置
javascript
docker inspect cl
找到network 下的 IP addres
javascript
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "fbe81fd305ccd324f831173adbb3ceaec3142835ef4763bb4fd01e5499cd4be4",
"EndpointID": "fcc3b650396b1caf173fe0308b2b22e068186b0cd87a05ee635679367b7f0284",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:11:00:02",
"DriverOpts": null
}
}
将ip地址写入docker配置
javascript
sudo vim /usr/lib/systemd/system/docker.service
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always
重启docker
javascript
sudo systemctl daemon-reload
sudo systemctl restart docker
之后你就会发现不管拉啥都贼快!!!
v:Liululu_0503