<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>docker设置代理 &#8211; moneyslow.com</title>
	<atom:link href="https://moneyslow.com/tag/docker%e8%ae%be%e7%bd%ae%e4%bb%a3%e7%90%86/feed" rel="self" type="application/rss+xml" />
	<link>https://moneyslow.com</link>
	<description>making money with technology</description>
	<lastBuildDate>Fri, 22 Jan 2021 06:24:53 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.5</generator>
	<item>
		<title>Docker设置配置的三种方式</title>
		<link>https://moneyslow.com/docker%e8%ae%be%e7%bd%ae%e9%85%8d%e7%bd%ae%e7%9a%84%e4%b8%89%e7%a7%8d%e6%96%b9%e5%bc%8f.html</link>
		
		<dc:creator><![CDATA[moneyslow]]></dc:creator>
		<pubDate>Fri, 22 Jan 2021 06:24:53 +0000</pubDate>
				<category><![CDATA[newest]]></category>
		<category><![CDATA[docker设置代理]]></category>
		<guid isPermaLink="false">https://moneyslow.com/?p=12595</guid>

					<description><![CDATA[一、利用Linux的http_proxy等环境变量的dockerd代理 在执行docker pull时，是由守护进程dockerd来执行。 因此，代理需要配在dockerd的环境中。 而这个环境，则是受systemd所管控，因此实际是systemd的配置。 sudo mkdir -p /etc/systemd/system/docker.service.d sudo touch /etc/systemd/system/docker.service.d/proxy.conf 在这个proxy.conf文件中，添加以下内容： [Service] Environment="HTTP_PROXY=http://proxy.money.com:8080/" Environment="HTTPS_PROXY=http://proxy.money.com:8080/" Environment="NO_PROXY=localhost,127.0.0.1,.money.com" 二、Container代理：在容器运行阶段，如果需要代理上网，则需要配置~/.docker/config.json。 以下配置，只在Docker 17.07及以上版本生效。 { "proxies": { "default": { "httpProxy": "http://proxy.money.com:8080", "httpsProxy": "http://proxy.money.com:8080", "noProxy": "localhost,127.0.0.1,.money.com" } } } 这个是用户级的配置，除了proxies，docker login等相关信息也会在其中。 而且还可以配置信息展示的格式、插件参数等。此外，容器的网络代理，也可以直接在其运行时通过-e注入http_proxy等环境变量。 这两种方法分别适合不同场景。 config.json非常方便，默认在所有配置修改后启动的容器生效，适合个人开发环境。 在CI/CD的自动构建环境、或者实际上线运行的环境中，这种方法就不太合适，用-e注入这种显式配置会更好，减轻对构建、部署环境的依赖。 当然，在这些环境中，最好用良好的设计避免配置代理上网。 三、docker build代理：虽然docker build的本质，也是启动一个容器，但是环境会略有不同，用户级配置无效。 在构建时，需要注入http_proxy等参数。 docker build . \ --build-arg "HTTP_PROXY=http://proxy.money.com:8080/" \ --build-arg "HTTPS_PROXY=http://proxy.money.com:8080/" \ [&#8230;]]]></description>
		
		
		
			</item>
	</channel>
</rss>
