Posts List

docker 使用笔记

1. docker下载image设置代理proxy $ docker pull busybox Using default tag: latest Pulling repository Network timed out while trying to connect to You may want to check your internet connection or if you are behind a proxy. 如果系统是用systemd启动docker的daemon的话,docker不会使用系统默认的代理,需要做如下操作,参考 1. 为docker创建systemd配置文件夹 $ mkdir /etc/systemd/system/docker.service.d 2. 创建 /etc/systemd/system/docker.service.d/http-proxy.conf 包含下面内容: [Service] Environment="HTTP_PROXY=" Environment="HTTPS_PROXY=" 对于不想使用代理的域名ip地址,使用NO_PROXY关键字 Environment="HTTP_PROXY=" "NO_PROXY=localhost,," 3. systemd重新加载 $ sudo systemctl daemon-reload 4. 查看配置是否生效 $ systemctl show --property=Environment docker Environment=HTTP_PROXY= 5. 重启docker