Docker 设置代理

当你到要如下的Error log,很可能是代理没有设置好

Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on xx.xx.xx.xx:53: no such host

用 Ubuntu 16.04 举例子
编辑下面的文件
/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
Environment="HTTP_PROXY=http://xx.xx.xx.xx:xxxxxx"                                                                                                              
Environment="HTTPS_PROXY=http://xx.xx.xx.xx:xxxxxx"
ExecStart=/usr/bin/dockerd -H fd:// --storage-driver=aufs

根据你的 Proxy 配置,如下变量
Environment="HTTP_PROXY=http://xx.xx.xx.xx:xxxxxx"
Environment="HTTPS_PROXY=http://xx.xx.xx.xx:xxxxxx"

做完后,重新启动docker

  • systemctl daemon-reload
  • systemctl restart docker
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。