<?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>wsl 彙整 - 泰克哪裡去</title>
	<atom:link href="https://tech.uccu.website/tag/wsl/feed" rel="self" type="application/rss+xml" />
	<link>https://tech.uccu.website/tag/wsl</link>
	<description>一個科技相關的隨手記錄網站</description>
	<lastBuildDate>Sat, 28 Aug 2021 15:50:09 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.1</generator>
<site xmlns="com-wordpress:feed-additions:1">119574712</site>	<item>
		<title>WSL啟動時，自動啟動Docker服務</title>
		<link>https://tech.uccu.website/auto-start-docker-service-when-wsl-start.html?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=auto-start-docker-service-when-wsl-start</link>
					<comments>https://tech.uccu.website/auto-start-docker-service-when-wsl-start.html#respond</comments>
		
		<dc:creator><![CDATA[鳴人]]></dc:creator>
		<pubDate>Thu, 10 Sep 2020 09:11:37 +0000</pubDate>
				<category><![CDATA[Docker]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[docker]]></category>
		<category><![CDATA[wsl]]></category>
		<guid isPermaLink="false">https://tech.uccu.website/?p=94</guid>

					<description><![CDATA[<p>如果有看前一篇文章，也就是在WSL中安裝原生的Docker環境，可能在電腦重新啟動之後輸入wsl進入Linux ... <a title="WSL啟動時，自動啟動Docker服務" class="read-more" href="https://tech.uccu.website/auto-start-docker-service-when-wsl-start.html" aria-label="Read more about WSL啟動時，自動啟動Docker服務">閱讀全文</a></p>
<p>這篇文章 <a href="https://tech.uccu.website/auto-start-docker-service-when-wsl-start.html">WSL啟動時，自動啟動Docker服務</a> 最早出現於 <a href="https://tech.uccu.website">泰克哪裡去</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>如果有看前一篇文章，也就是在WSL中安裝原生的Docker環境，可能在電腦重新啟動之後輸入wsl進入Linux子系統時，會發現docker怎麼好像又不能使用了？</p>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" fetchpriority="high" decoding="async" width="1024" height="152" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/5682d84c-image-1024x152.png?resize=1024%2C152&#038;ssl=1" alt="Docker服務未啟動(Server無法連線)" class="wp-image-84" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/5682d84c-image.png?resize=1024%2C152&amp;ssl=1 1024w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/5682d84c-image.png?resize=300%2C45&amp;ssl=1 300w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/5682d84c-image.png?resize=768%2C114&amp;ssl=1 768w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/5682d84c-image.png?w=1351&amp;ssl=1 1351w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption>重新啟動wsl之後輸入docker的指令無法使用</figcaption></figure>



<p>其實這只是因為電腦重新啟動後，WSL環境也是重新啟動，所有額外安裝的程式與服務都需要手動重新啟動它們，所以這時候只要再輸入<code>sudo service docker start</code>，再執行docker的指令就可以正常工作了。</p>



<p>不過每次WSL重新啟動之後都需要輸入指令讓docker服務啟動，說實在的有一點麻煩，因為通常用到WSL的時候就是要在裡面跑docker container，所以如果在輸入wsl進入Linux子系統環境的時候就能夠自動將服務啟動的話，那不是方便很多嗎？</p>



<p>這一篇文章就是說明該如何在Linux子系統設定自動啟動docker服務，這個概念其實就和Windows作業系統啟動的時候要執行什麼事情所做的設定是相同的概念，所以也不限於使用在WSL的環境喔！</p>



<span id="more-94"></span>



<h3 class="wp-block-heading">自動啟動Docker服務</h3>



<p>首先，進入WSL之後，輸入<code>cd ~</code>切換到使用者的根目錄，接著再輸入<code>sudo nano .bashrc</code>，透過nano編輯.bashrc這個檔案。</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img data-recalc-dims="1" decoding="async" width="537" height="99" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/1fdf22ea-image.png?resize=537%2C99&#038;ssl=1" alt="" class="wp-image-95" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/1fdf22ea-image.png?w=537&amp;ssl=1 537w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/1fdf22ea-image.png?resize=300%2C55&amp;ssl=1 300w" sizes="(max-width: 537px) 100vw, 537px" /><figcaption>切換到使用者根目錄編輯.bashrc檔案</figcaption></figure></div>



<p>接著會看到裡面有一堆的設定值，直接在最上面第一行將啟動docker的指令<code>sudo service docker start</code>輸入進去，然後按下鍵盤的ctrl+x離開，詢問要不要儲存檔案的時候按y，接著再直接按enter就行了。</p>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" decoding="async" width="1024" height="233" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/b96156ef-image-1024x233.png?resize=1024%2C233&#038;ssl=1" alt="" class="wp-image-96" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/b96156ef-image.png?resize=1024%2C233&amp;ssl=1 1024w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/b96156ef-image.png?resize=300%2C68&amp;ssl=1 300w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/b96156ef-image.png?resize=768%2C175&amp;ssl=1 768w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/b96156ef-image.png?w=1297&amp;ssl=1 1297w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption>在.bashrc檔案的第一行加入啟動docker服務的指令</figcaption></figure>



<p>到這個動作其實已經可以讓WSL在啟動的時候自動將docker服務啟動起來，不過這樣子只能算是完成了一半，因為在WSL啟動的時候仍然需要一個麻煩的動作：輸入密碼。</p>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1024" height="201" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/e0044eed-image-1024x201.png?resize=1024%2C201&#038;ssl=1" alt="" class="wp-image-97" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/e0044eed-image.png?resize=1024%2C201&amp;ssl=1 1024w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/e0044eed-image.png?resize=300%2C59&amp;ssl=1 300w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/e0044eed-image.png?resize=768%2C151&amp;ssl=1 768w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/e0044eed-image.png?resize=1536%2C302&amp;ssl=1 1536w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/e0044eed-image.png?w=1675&amp;ssl=1 1675w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /><figcaption>WSL啟動時因為利用sudo去啟動docker服務，所以需要輸入密碼</figcaption></figure>



<h3 class="wp-block-heading">省略輸入密碼設定</h3>



<p>其實輸入密碼的這個動作也是可以設定成不需要輸入，同樣是透過編輯設定就行。</p>



<p>進入WSL之後輸入<code>sudo visudo</code>，進入設定編輯畫面，這次我們選擇在最下面一行輸入設定值：</p>



<p><code>&lt;em&gt;帳號&lt;/em&gt; ALL=(ALL) NOPASSWD: ALL</code></p>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1024" height="642" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/1897d48c-image-1024x642.png?resize=1024%2C642&#038;ssl=1" alt="" class="wp-image-98" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/1897d48c-image.png?resize=1024%2C642&amp;ssl=1 1024w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/1897d48c-image.png?resize=300%2C188&amp;ssl=1 300w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/1897d48c-image.png?resize=768%2C482&amp;ssl=1 768w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/1897d48c-image.png?w=1427&amp;ssl=1 1427w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /><figcaption>將WSL環境執行的帳號加入sudoer，執行sudo指令的時候不需要輸入密碼</figcaption></figure>



<p>輸入完之後，同樣按下鍵盤的ctrl+x離開，詢問要不要儲存檔案的時候按y，接著再直接按enter離開就行了。</p>



<p>完成之後同樣離開WSL環境，並且將WSL終止(<code>wsl -t &lt;em&gt;WSL子系統Distro名稱&lt;/em&gt;</code>)，重新輸入wsl進入Linux子系統，可以看到下圖與上面的差異，需要輸入密碼的步驟已經省略掉了。</p>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1024" height="128" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/49f7c810-image-1024x128.png?resize=1024%2C128&#038;ssl=1" alt="" class="wp-image-99" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/49f7c810-image.png?resize=1024%2C128&amp;ssl=1 1024w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/49f7c810-image.png?resize=300%2C37&amp;ssl=1 300w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/49f7c810-image.png?resize=768%2C96&amp;ssl=1 768w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/49f7c810-image.png?resize=1536%2C192&amp;ssl=1 1536w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/49f7c810-image.png?w=1673&amp;ssl=1 1673w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /><figcaption>進入WSL環境並且啟動docker服務已經不需要再輸入密碼了</figcaption></figure>



<h3 class="wp-block-heading">參考來源</h3>



<ul class="wp-block-list"><li><a aria-label="undefined (opens in a new tab)" href="https://superuser.com/questions/1343558/hot-to-make-wsl-run-services-at-startup" target="_blank" rel="noreferrer noopener nofollow">How to make WSL run services at startup</a></li></ul>
<p>這篇文章 <a href="https://tech.uccu.website/auto-start-docker-service-when-wsl-start.html">WSL啟動時，自動啟動Docker服務</a> 最早出現於 <a href="https://tech.uccu.website">泰克哪裡去</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://tech.uccu.website/auto-start-docker-service-when-wsl-start.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">94</post-id>	</item>
		<item>
		<title>同一台電腦可執行Windows與Linux Container？在WSL2安裝原生Docker環境</title>
		<link>https://tech.uccu.website/how-to-install-docker-on-wsl2.html?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-install-docker-on-wsl2</link>
					<comments>https://tech.uccu.website/how-to-install-docker-on-wsl2.html#respond</comments>
		
		<dc:creator><![CDATA[鳴人]]></dc:creator>
		<pubDate>Thu, 10 Sep 2020 09:10:50 +0000</pubDate>
				<category><![CDATA[Docker]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[container]]></category>
		<category><![CDATA[docker]]></category>
		<category><![CDATA[wsl]]></category>
		<guid isPermaLink="false">https://tech.uccu.website/?p=70</guid>

					<description><![CDATA[<p>如果想要在同一台電腦中既可以執行Windows Container，又可以執行Linux Container， ... <a title="同一台電腦可執行Windows與Linux Container？在WSL2安裝原生Docker環境" class="read-more" href="https://tech.uccu.website/how-to-install-docker-on-wsl2.html" aria-label="Read more about 同一台電腦可執行Windows與Linux Container？在WSL2安裝原生Docker環境">閱讀全文</a></p>
<p>這篇文章 <a href="https://tech.uccu.website/how-to-install-docker-on-wsl2.html">同一台電腦可執行Windows與Linux Container？在WSL2安裝原生Docker環境</a> 最早出現於 <a href="https://tech.uccu.website">泰克哪裡去</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>如果想要在同一台電腦中既可以執行Windows Container，又可以執行Linux Container，以便測試程式在不同環境之下執行的結果或是設定值的差異，該如何達到這樣的需求呢？</p>



<p>答案就是：利用Windows中的Linux子系統(Windows Subsystem for Linux, WSL)。</p>



<p>透過WSL安裝Linux子系統之後，可以在Linux子系統中安裝原生的Docker執行環境，在Windows環境中則是安裝Docker Desktop並且切換到使用Windows Container，這樣一來就可以在Windows環境執行Windows Container，Linux子系統中執行Linux Container了。</p>



<p><em>註：WSL是Windows 10的功能，版本又分為Version 1(WSL)與Version 2(WSL2)，WSL2只能在Windows 10 2004版(組建19041以上)執行。(<a href="https://docs.microsoft.com/zh-tw/windows/wsl/" target="_blank" aria-label="undefined (opens in a new tab)" rel="noreferrer noopener nofollow">參考官方wsl文件說明</a>)</em></p>



<p>在開始之前，先輸入<code class="language-bash">wsl -l -v</code>查看一下系統內安裝的Linux子系統是執行在哪一個版本(1或2)。<br>在Linux子系統中要執行原生的Docker，只能在Version 2的版本(WSL2)。</p>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" loading="lazy" decoding="async" width="657" height="229" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/3955add2-image.png?resize=657%2C229&#038;ssl=1" alt="" class="wp-image-71" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/3955add2-image.png?w=657&amp;ssl=1 657w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/3955add2-image.png?resize=300%2C105&amp;ssl=1 300w" sizes="auto, (max-width: 657px) 100vw, 657px" /><figcaption>使用<code>wsl -l -v</code>查看系統中 Linux子系統執行的版本</figcaption></figure>



<span id="more-70"></span>



<p>先輸入<code class="language-bash">docker info</code>確認系統中沒有安裝docker。</p>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" loading="lazy" decoding="async" width="943" height="247" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/7f0c8bfc-image.png?resize=943%2C247&#038;ssl=1" alt="" class="wp-image-72" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/7f0c8bfc-image.png?w=943&amp;ssl=1 943w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/7f0c8bfc-image.png?resize=300%2C79&amp;ssl=1 300w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/7f0c8bfc-image.png?resize=768%2C201&amp;ssl=1 768w" sizes="auto, (max-width: 943px) 100vw, 943px" /><figcaption>輸入<code>docker info</code>確認系統中確實沒有安裝docker</figcaption></figure>



<p>接著，根據官方的安裝指引將Docker Engine安裝到Linux子系統中：</p>



<ul class="wp-block-list"><li>Ubuntu：<a aria-label="undefined (opens in a new tab)" href="https://docs.docker.com/engine/install/ubuntu/" target="_blank" rel="noreferrer noopener nofollow">https://docs.docker.com/engine/install/ubuntu/</a></li><li>Debian：<a aria-label="undefined (opens in a new tab)" href="https://docs.docker.com/engine/install/debian/" target="_blank" rel="noreferrer noopener nofollow">https://docs.docker.com/engine/install/debian/</a></li><li>CentOS：<a aria-label="undefined (opens in a new tab)" href="https://docs.docker.com/engine/install/centos/" target="_blank" rel="noreferrer noopener nofollow">https://docs.docker.com/engine/install/centos/</a></li><li>Fedora：<a href="https://docs.docker.com/engine/install/fedora/" target="_blank" aria-label="undefined (opens in a new tab)" rel="noreferrer noopener nofollow">https://docs.docker.com/engine/install/fedora/</a></li></ul>



<h4 class="wp-block-heading">更新系統中的套件</h4>



<p>先輸入<code class="language-bash">sudo apt-get update</code>更新系統中的套件。</p>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1024" height="906" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/4afb5ecb-image-1024x906.png?resize=1024%2C906&#038;ssl=1" alt="" class="wp-image-73" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/4afb5ecb-image.png?resize=1024%2C906&amp;ssl=1 1024w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/4afb5ecb-image.png?resize=300%2C265&amp;ssl=1 300w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/4afb5ecb-image.png?resize=768%2C680&amp;ssl=1 768w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/4afb5ecb-image.png?w=1269&amp;ssl=1 1269w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /><figcaption>先輸入<code>sudo apt-get</code>更新系統中的套件</figcaption></figure>



<h4 class="wp-block-heading">安裝需要的套件</h4>



<p>再輸入下列指令安裝docker需要的其它套件：</p>



<pre class="wp-block-prismatic-blocks"><code class="language-bash">sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common</code></pre>



<p><em>註：「\」符號是Linux指令的換行連接符號，用來將較長的指令換行輸入，實際上在系統中仍然是組合成一整行的指令，因此也可以將上面的指令直接輸入成一行。(記得拿掉「\」符號)</em></p>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" loading="lazy" decoding="async" width="827" height="175" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/5ee778d6-image.png?resize=827%2C175&#038;ssl=1" alt="" class="wp-image-74" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/5ee778d6-image.png?w=827&amp;ssl=1 827w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/5ee778d6-image.png?resize=300%2C63&amp;ssl=1 300w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/5ee778d6-image.png?resize=768%2C163&amp;ssl=1 768w" sizes="auto, (max-width: 827px) 100vw, 827px" /><figcaption>安裝docker前需要安裝的套件</figcaption></figure>



<p>安裝上述幾個套件的過程中會碰到詢問y/n的問題，通常是告知會使用多少磁碟空間，輸入y繼續安裝就行了。</p>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1024" height="749" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/6958cf39-image-1024x749.png?resize=1024%2C749&#038;ssl=1" alt="" class="wp-image-75" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/6958cf39-image.png?resize=1024%2C749&amp;ssl=1 1024w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/6958cf39-image.png?resize=300%2C220&amp;ssl=1 300w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/6958cf39-image.png?resize=768%2C562&amp;ssl=1 768w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/6958cf39-image.png?w=1499&amp;ssl=1 1499w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /><figcaption>安裝apt-transport-https、ca-certificates、curl、gnupg-agent、software-properties-common套件與其相依的套件</figcaption></figure>



<h4 class="wp-block-heading">取得GPG Key</h4>



<p>接下來取得docker的GPG key：</p>



<pre class="wp-block-prismatic-blocks"><code class="language-bash">curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -</code></pre>



<p><em>註：「|」符號是Linux中的命令管線符號，用來將前一個命令執行的結果送到下一個命令的輸入。</em></p>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1024" height="39" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/88c5a78e-image-1024x39.png?resize=1024%2C39&#038;ssl=1" alt="" class="wp-image-76" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/88c5a78e-image.png?resize=1024%2C39&amp;ssl=1 1024w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/88c5a78e-image.png?resize=300%2C11&amp;ssl=1 300w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/88c5a78e-image.png?resize=768%2C29&amp;ssl=1 768w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/88c5a78e-image.png?w=1505&amp;ssl=1 1505w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /><figcaption>透過curl取得docker的GPG key</figcaption></figure>



<p>接下來<strong>這一步可以跳過</strong>，只是用來驗證剛才取得的GPG key是否正確。</p>



<pre class="wp-block-prismatic-blocks"><code class="language-bash">sudo apt-key fingerprint 0EBFCD88</code></pre>



<p>輸入完之後會看到下面<code>9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88</code>的內容。</p>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" loading="lazy" decoding="async" width="947" height="145" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/eb1ab3ee-image.png?resize=947%2C145&#038;ssl=1" alt="" class="wp-image-77" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/eb1ab3ee-image.png?w=947&amp;ssl=1 947w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/eb1ab3ee-image.png?resize=300%2C46&amp;ssl=1 300w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/eb1ab3ee-image.png?resize=768%2C118&amp;ssl=1 768w" sizes="auto, (max-width: 947px) 100vw, 947px" /><figcaption>驗證取得的GPG key</figcaption></figure>



<h4 class="wp-block-heading">加入套件存放庫(Repository)</h4>



<p>接下來將docker官方的套件存放庫(repository)加入到Linux子系統中，這樣才能夠安裝docker engine：</p>



<pre class="wp-block-prismatic-blocks"><code class="language-bash">sudo add-apt-repository \
&quot;deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable&quot;</code></pre>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1024" height="319" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/a5c90088-image-1024x319.png?resize=1024%2C319&#038;ssl=1" alt="" class="wp-image-80" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/a5c90088-image.png?resize=1024%2C319&amp;ssl=1 1024w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/a5c90088-image.png?resize=300%2C94&amp;ssl=1 300w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/a5c90088-image.png?resize=768%2C240&amp;ssl=1 768w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/a5c90088-image.png?w=1087&amp;ssl=1 1087w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /><figcaption>將docker的套件庫加入到系統中</figcaption></figure>



<p><em>小提示：如果你發現你的網址輸入錯誤．也就是在輸入指令之後下面的訊息有顯示Err的字樣，那麼可以編輯套件庫清單的設定檔，將錯誤的網址修正或移除重新加入。</em>(<a aria-label="undefined (opens in a new tab)" href="https://unix.stackexchange.com/questions/219341/how-to-apt-delete-repository" target="_blank" rel="noreferrer noopener nofollow">參考來源</a>)</p>



<pre class="wp-block-prismatic-blocks"><code class="language-bash">sudo nano /etc/apt/sources.list</code></pre>



<h4 class="wp-block-heading">安裝Docker Engine</h4>



<p>輸入下面兩行指令安裝Docker Engine，第一行是更新套件指令，第二行則是安裝Docker的指令</p>



<pre class="wp-block-prismatic-blocks"><code class="language-bash">sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io</code></pre>



<p>安裝過程中會有個磁碟空間耗用的問題，輸入y就能繼續。<br>接著會碰到下面的問題，是詢問grub-pc套件要裝在哪一個磁碟分割：</p>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1024" height="423" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/f688bcfe-image-1024x423.png?resize=1024%2C423&#038;ssl=1" alt="" class="wp-image-81" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/f688bcfe-image.png?resize=1024%2C423&amp;ssl=1 1024w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/f688bcfe-image.png?resize=300%2C124&amp;ssl=1 300w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/f688bcfe-image.png?resize=768%2C317&amp;ssl=1 768w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/f688bcfe-image.png?resize=1536%2C635&amp;ssl=1 1536w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/f688bcfe-image.png?w=1619&amp;ssl=1 1619w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /><figcaption>選擇grub-pc套件要安裝的目標</figcaption></figure>



<p>grub-pc應該是一個啟動管理的套件，不太確定是上面哪個套件相依的需求，以上圖來看，Linux子系統抓到三個(實際上只有sda、sdb兩個)容量大小相同的項目。<br>透過空白鍵可以選擇/取消，想知道sda、sdb分別是什麼的話，可以再另外開一個cmd或powershell視窗，輸入wsl透過另外一個terminal進入查看：</p>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" loading="lazy" decoding="async" width="867" height="565" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/b287d344-image.png?resize=867%2C565&#038;ssl=1" alt="" class="wp-image-82" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/b287d344-image.png?w=867&amp;ssl=1 867w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/b287d344-image.png?resize=300%2C196&amp;ssl=1 300w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/b287d344-image.png?resize=768%2C500&amp;ssl=1 768w" sizes="auto, (max-width: 867px) 100vw, 867px" /><figcaption>透過<code>df -h</code>、<code>lsblk</code>、<code>sudo blkid</code>指令查看磁碟資訊</figcaption></figure>



<p>從上面可以發現sda、sdb其實是一樣的，只是檔案系統實際上掛載在sdb項目，所以選擇sda、sdb也許都可以，不過實際上選擇第一個sda項目的時候，安裝到一半會出現下面的錯誤訊息：</p>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1024" height="299" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/71a5ac8f-image-1024x299.png?resize=1024%2C299&#038;ssl=1" alt="" class="wp-image-83" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/71a5ac8f-image.png?resize=1024%2C299&amp;ssl=1 1024w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/71a5ac8f-image.png?resize=300%2C88&amp;ssl=1 300w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/71a5ac8f-image.png?resize=768%2C224&amp;ssl=1 768w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/71a5ac8f-image.png?w=1223&amp;ssl=1 1223w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /><figcaption>無法安裝在sda</figcaption></figure>



<p>既然無法安裝在sda，那麼就不要霸王硬上弓硬是要安裝在sda，所以選擇No之後，回到上面的選單項目，將sda取消，選擇第二個sdb試試。<br>沒有再出現上面無法安裝詢問是否要霸王硬上弓的問題，順利安裝完成。</p>



<p>輸入<code>docker info</code>查看安裝的結果，只顯示client資訊，server資訊則是無法連線，其實這只是docker service沒有啟動的關係。</p>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1024" height="152" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/5682d84c-image-1024x152.png?resize=1024%2C152&#038;ssl=1" alt="" class="wp-image-84" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/5682d84c-image.png?resize=1024%2C152&amp;ssl=1 1024w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/5682d84c-image.png?resize=300%2C45&amp;ssl=1 300w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/5682d84c-image.png?resize=768%2C114&amp;ssl=1 768w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/5682d84c-image.png?w=1351&amp;ssl=1 1351w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>輸入<code>sudo service docker start</code>啟動docker服務，再次輸入<code>docker info</code>查看docker的資訊卻發現…</p>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1024" height="149" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/afb2eb9d-image-1024x149.png?resize=1024%2C149&#038;ssl=1" alt="" class="wp-image-85" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/afb2eb9d-image.png?resize=1024%2C149&amp;ssl=1 1024w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/afb2eb9d-image.png?resize=300%2C44&amp;ssl=1 300w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/afb2eb9d-image.png?resize=768%2C112&amp;ssl=1 768w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/afb2eb9d-image.png?resize=1536%2C224&amp;ssl=1 1536w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/afb2eb9d-image.png?w=1559&amp;ssl=1 1559w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>看起來和上面那張截圖滿像的，不過最後有個關鍵字是「permission denied」。<br>既然如此，那使用sudo執行看看呢？(<code>sudo docker info</code>)</p>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" loading="lazy" decoding="async" width="868" height="1024" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/9cd58616-image-868x1024.png?resize=868%2C1024&#038;ssl=1" alt="" class="wp-image-87" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/9cd58616-image.png?resize=868%2C1024&amp;ssl=1 868w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/9cd58616-image.png?resize=254%2C300&amp;ssl=1 254w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/9cd58616-image.png?resize=768%2C906&amp;ssl=1 768w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/9cd58616-image.png?w=1123&amp;ssl=1 1123w" sizes="auto, (max-width: 868px) 100vw, 868px" /></figure>



<p>Bingo，能夠正常查看到docker的資訊了！</p>



<p>不過這樣每次要執行docker相關的指令都要輸入sudo有點麻煩，所以接著可以利用下面的指令，將docker加入特定的用戶群：</p>



<pre class="wp-block-prismatic-blocks"><code class="language-bash">sudo usermod -aG docker 帳號</code></pre>



<p>輸入完上面的指令之後，如果直接再次輸入docker info想要試試是否有效，會得到令人失望的結果。主要是因為當下使用的terminal沒有登出再重新登入取得最新的資訊，只要退出terminal之後再重新執行就可以正常了。</p>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1024" height="669" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/28de246d-image-1024x669.png?resize=1024%2C669&#038;ssl=1" alt="" class="wp-image-88" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/28de246d-image.png?resize=1024%2C669&amp;ssl=1 1024w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/28de246d-image.png?resize=300%2C196&amp;ssl=1 300w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/28de246d-image.png?resize=768%2C502&amp;ssl=1 768w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/28de246d-image.png?resize=1536%2C1003&amp;ssl=1 1536w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/28de246d-image.png?w=1557&amp;ssl=1 1557w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /><figcaption>輸入完<code>sudo usermod -aG docker &lt;em&gt;帳號&lt;/em&gt;</code>，需要離開wsl再重新進入才會生效</figcaption></figure>



<p>OK，這下子終於將docker順利安裝在WSL2裡面啦~</p>



<p>從下面的截圖也可以發現，在wsl裡面查看docker info和windows底下查看docker info的差異，證明兩個docker環境是彼此分開獨立的喔！</p>



<p>PS.Windows環境安裝Docker Desktop並且切換到Windows Container模式了，這樣一來就可以在一台電腦中同時執行Linux Container與Windows Container了。</p>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1024" height="787" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/d696fac4-image-1024x787.png?resize=1024%2C787&#038;ssl=1" alt="" class="wp-image-90" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/d696fac4-image.png?resize=1024%2C787&amp;ssl=1 1024w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/d696fac4-image.png?resize=300%2C230&amp;ssl=1 300w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/d696fac4-image.png?resize=768%2C590&amp;ssl=1 768w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/d696fac4-image.png?resize=1536%2C1180&amp;ssl=1 1536w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/08/d696fac4-image.png?w=1725&amp;ssl=1 1725w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /><figcaption>同一台電腦中同時執行Windows Docker與Linux Docker環境</figcaption></figure>
<p>這篇文章 <a href="https://tech.uccu.website/how-to-install-docker-on-wsl2.html">同一台電腦可執行Windows與Linux Container？在WSL2安裝原生Docker環境</a> 最早出現於 <a href="https://tech.uccu.website">泰克哪裡去</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://tech.uccu.website/how-to-install-docker-on-wsl2.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">70</post-id>	</item>
		<item>
		<title>Windows 10 Home家用版安裝Hyper-V與Docker</title>
		<link>https://tech.uccu.website/windows10-home-install-hyperv-docker.html?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=windows10-home-install-hyperv-docker</link>
					<comments>https://tech.uccu.website/windows10-home-install-hyperv-docker.html#respond</comments>
		
		<dc:creator><![CDATA[鳴人]]></dc:creator>
		<pubDate>Tue, 19 May 2020 08:05:08 +0000</pubDate>
				<category><![CDATA[Docker]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[container]]></category>
		<category><![CDATA[docker]]></category>
		<category><![CDATA[hyper-v]]></category>
		<category><![CDATA[windows 10 home]]></category>
		<category><![CDATA[wsl]]></category>
		<guid isPermaLink="false">https://tech.uccu.website/?p=30</guid>

					<description><![CDATA[<p>公司一開始配的電腦是Acer的套裝電腦，裡面搭配的是Windows 10 Home版，作為一個開發者，Home ... <a title="Windows 10 Home家用版安裝Hyper-V與Docker" class="read-more" href="https://tech.uccu.website/windows10-home-install-hyperv-docker.html" aria-label="Read more about Windows 10 Home家用版安裝Hyper-V與Docker">閱讀全文</a></p>
<p>這篇文章 <a href="https://tech.uccu.website/windows10-home-install-hyperv-docker.html">Windows 10 Home家用版安裝Hyper-V與Docker</a> 最早出現於 <a href="https://tech.uccu.website">泰克哪裡去</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>公司一開始配的電腦是Acer的套裝電腦，裡面搭配的是Windows 10 Home版，作為一個開發者，Home版本的功能實在是不太符合需求，因為預設應該是沒有Hyper-V功能，如果要安裝Docker的話，也只能安裝Client工具…</p>



<p>不太想要動到OS重灌這一招，想到之前似乎有試過(看到)在Windows 10 Home版安裝Hyper-V與WSL，不過因為很久沒有寫部落格記錄，有些問題解決之後就沒有記錄，所以趁著這次解決這個問題並且將部落格從幾次亂搞之後最近放到Google Cloud Run上面執行，一併將這些操作記錄下來。</p>



<span id="more-30"></span>



<p class="has-text-align-left">首先，Windows 10 Home版打開控制台「程式和功能」中的「Windows 功能」應該不會有「Hyper-V平台」、「適用於 Linux 的 Windows 子系統」兩個選項。</p>



<p class="has-text-align-center"><img data-recalc-dims="1" loading="lazy" decoding="async" width="600" height="400" class="wp-image-33" style="width: 600px;" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/05/b94afa4b-windows10-home-windows-features.png?resize=600%2C400&#038;ssl=1" alt="Windows 10 Home家用版Windows功能" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/05/b94afa4b-windows10-home-windows-features.png?w=731&amp;ssl=1 731w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/05/b94afa4b-windows10-home-windows-features.png?resize=300%2C200&amp;ssl=1 300w" sizes="auto, (max-width: 600px) 100vw, 600px" /></p>



<p>從<a href="https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/reference/hyper-v-requirements">Windows 10 Hyper-V System Requirements</a>的頁面說明中也有下面這段，明確表明Windows 10 Home的版本不能安裝。</p>



<p>The Hyper-V role&nbsp;<strong>cannot</strong>&nbsp;be installed on:</p>



<ul class="wp-block-list"><li>Windows 10 Home</li><li>Windows 10 Mobile</li><li>Windows 10 Mobile Enterprise</li></ul>



<p>不過這個其實有秘技可以讓Hyper-V安裝在Windows 10 Home，只需要將下面這段指令貼在記事本上，並且以.bat的副檔名儲存後透過管理員權限執行即可。</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>pushd &#8220;%~dp0&#8221;<br>dir /b %SystemRoot%\servicing\Packages*Hyper-V*.mum &gt;hyper-v.txt<br>for /f %%i in (&#8216;findstr /i . hyper-v.txt 2^&gt;nul&#8217;) do dism /online /norestart /add-package:&#8221;%SystemRoot%\servicing\Packages\%%i&#8221;<br>del hyper-v.txt<br>Dism /online /enable-feature /featurename:Microsoft-Hyper-V -All /LimitAccess /ALL<br>pause</p></blockquote>



<p>如果也想要安裝Container功能的話，同樣將下面這段指令以.bat儲存後透過管理員權限執行。</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>pushd &#8220;%~dp0&#8221;<br>dir /b %SystemRoot%\servicing\Packages*containers*.mum &gt;containers.txt<br>for /f %%i in (&#8216;findstr /i . containers.txt 2^&gt;nul&#8217;) do dism /online /norestart /add-package:&#8221;%SystemRoot%\servicing\Packages\%%i&#8221;<br>del containers.txt<br>Dism /online /enable-feature /featurename:Containers -All /LimitAccess /ALL<br>pause</p></blockquote>



<p>執行完之後重新開機應該就可以找到Hyper-V的功能了，不過到這裡為止，仍然無法安裝Docker。<br>或者是說，如果不是<a href="https://docs.docker.com/docker-for-windows/install-windows-home/">Windows 10 Home搭配Docker使用WSL2(Windows Subsystem for Linux, WSL)</a>，那麼就無法使用Docker。</p>



<p>再更精確一點的說法，就是<a href="https://docs.docker.com/docker-for-windows/install/">Docker需要Hyper-V與Container的功能</a>，如果是Windows Home安裝WSL2再加上Docker，那麼就是在WSL2裡面執行Container，跑的是Linux，如果只需要執行Linux的Container是OK的。</p>



<p>不過若是需要在Windows Container和Linux Container之間切換的話，Windows 10 Home版本一般來說是無法達成，而且Docker搭配WSL2跑Linux Container若是使用到Docker-Compose的話，可能還會有一點點問題…</p>



<p>所以為了在Windows 10 Home的版本正常執行Docker(Hyper-V都透過秘技安裝了，應該還有秘技可以讓Docker正常在Windows 10 Home版本安裝與執行吧！)，所以我繼續在網路上搜尋可能的秘技，想要解決在Windows 10 Home版本使用Docker的問題。</p>



<p>這次的秘技不需要再執行指令安裝什麼東西，需要的是執行regedit編輯Windows登錄檔，透過將「HKLM\Software\Microsoft\Windows NT\CurrentVersion」底下的EditionID從「Core」更改為「Professional」，改完之後不需要重新開機，就可以執行最新版本的Docker安裝檔。</p>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" loading="lazy" decoding="async" width="963" height="680" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/05/7f9b43ce-changewindowseditionid_windowsregistry.png?resize=963%2C680&#038;ssl=1" alt="" class="wp-image-34" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/05/7f9b43ce-changewindowseditionid_windowsregistry.png?w=963&amp;ssl=1 963w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/05/7f9b43ce-changewindowseditionid_windowsregistry.png?resize=300%2C212&amp;ssl=1 300w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/05/7f9b43ce-changewindowseditionid_windowsregistry.png?resize=768%2C542&amp;ssl=1 768w" sizes="auto, (max-width: 963px) 100vw, 963px" /><figcaption>將EditionID從「Core」更改為「Professional」，改完之後不需要重新開機，就可以執行最新版本的Docker安裝檔</figcaption></figure>



<p>上面的這個修改Windows登錄檔的位置要記下來，或者是寫成一個指令檔。<br>因為Windows過一段時間(不知多久)會自己將更改的值改回「Core」(如果你改完忘了改回來)，尤其是Windows Update完之後。</p>



<p>這會有什麼影響呢？</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img data-recalc-dims="1" loading="lazy" decoding="async" width="336" height="351" src="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/05/cdf1ffcb-dockerswitchcontainerneedtochangewindowsregistry.png?resize=336%2C351&#038;ssl=1" alt="" class="wp-image-35" srcset="https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/05/cdf1ffcb-dockerswitchcontainerneedtochangewindowsregistry.png?w=336&amp;ssl=1 336w, https://i0.wp.com/storage.googleapis.com/stateless-tech-uccu-website/2020/05/cdf1ffcb-dockerswitchcontainerneedtochangewindowsregistry.png?resize=287%2C300&amp;ssl=1 287w" sizes="auto, (max-width: 336px) 100vw, 336px" /><figcaption>EditionID為「Core」的情況下無法切換Container</figcaption></figure></div>



<p>會影響的就是Docker切換Windows Container與更新Docker版本，如果Docker發現新的版本，但是當你要執行更新安裝的時候發現有問題，可以試著將EditionID再改為「Professional」，之後應該就可以更新了。<br>註：要透過Docker結合WSL2執行Linux Container必須是切換到Linux Container模式才行。<br>(不過也可以選擇不要在Windows下操作Docker跑Linux Container，直接在WSL2裡面安裝獨立的Docker)參考來源：</p>



<p><span>參考來源</span></p>



<ul class="wp-block-list"><li><a href="https://forums.docker.com/t/installing-docker-on-windows-10-home/11722">Installing Docker on Windows 10 Home</a></li></ul>
<p>這篇文章 <a href="https://tech.uccu.website/windows10-home-install-hyperv-docker.html">Windows 10 Home家用版安裝Hyper-V與Docker</a> 最早出現於 <a href="https://tech.uccu.website">泰克哪裡去</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://tech.uccu.website/windows10-home-install-hyperv-docker.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">30</post-id>	</item>
	</channel>
</rss>
