<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://homeostasis.scs.carleton.ca/wiki/index.php?action=history&amp;feed=atom&amp;title=COMP3000_Operating_Systems_W22%3A_Tutorial_9</id>
	<title>COMP3000 Operating Systems W22: Tutorial 9 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://homeostasis.scs.carleton.ca/wiki/index.php?action=history&amp;feed=atom&amp;title=COMP3000_Operating_Systems_W22%3A_Tutorial_9"/>
	<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W22:_Tutorial_9&amp;action=history"/>
	<updated>2026-06-02T20:24:03Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W22:_Tutorial_9&amp;diff=23969&amp;oldid=prev</id>
		<title>Lianyingzhao at 20:35, 29 March 2022</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W22:_Tutorial_9&amp;diff=23969&amp;oldid=prev"/>
		<updated>2022-03-29T20:35:28Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 20:35, 29 March 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;By the end of this tutorial, you will have a basic familiarity with the Docker platform and be able to run, operate, and customize containers, and create simple containers of your own. You will see how kernel building blocks like namespaces make containers possible.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;By the end of this tutorial, you will have a basic familiarity with the Docker platform and be able to run, operate, and customize containers, and create simple containers of your own. You will see how kernel building blocks like namespaces make containers possible.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Tutorials are graded based on participation and effort (&#039;&#039;&#039;so no need to try to have the “correct” answers — what matters is the process&#039;&#039;&#039;), but you should still turn in your work. Even if you have no idea about certain tasks or disagree about something, still make sure to document your confusions/opinions that reflect your thinking about that task. Submit your answers on Brightspace as a single text file named &quot;&amp;lt;username&amp;gt;-comp3000-&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;t8&lt;/del&gt;.txt&quot; (where username is your MyCarletonOne username). The first four lines of this file should be &quot;COMP 3000 Tutorial &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;8&lt;/del&gt;&quot;, your name, student number, and the date of submission.  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Tutorials are graded based on participation and effort (&#039;&#039;&#039;so no need to try to have the “correct” answers — what matters is the process&#039;&#039;&#039;), but you should still turn in your work. Even if you have no idea about certain tasks or disagree about something, still make sure to document your confusions/opinions that reflect your thinking about that task. Submit your answers on Brightspace as a single text file named &quot;&amp;lt;username&amp;gt;-comp3000-&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;t9&lt;/ins&gt;.txt&quot; (where username is your MyCarletonOne username). The first four lines of this file should be &quot;COMP 3000 Tutorial &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;9&lt;/ins&gt;&quot;, your name, student number, and the date of submission.  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The deadline is usually four days after the tutorial date (see the actual due date and &amp;#039;&amp;#039;&amp;#039;time&amp;#039;&amp;#039;&amp;#039; on the submission entry). Note that the submission entry is enforced by the system, so you may fail to get the effort marks even if it is one minute past the deadline.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The deadline is usually four days after the tutorial date (see the actual due date and &amp;#039;&amp;#039;&amp;#039;time&amp;#039;&amp;#039;&amp;#039; on the submission entry). Note that the submission entry is enforced by the system, so you may fail to get the effort marks even if it is one minute past the deadline.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W22:_Tutorial_9&amp;diff=23965&amp;oldid=prev</id>
		<title>Lianyingzhao at 19:39, 26 March 2022</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W22:_Tutorial_9&amp;diff=23965&amp;oldid=prev"/>
		<updated>2022-03-26T19:39:58Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 19:39, 26 March 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l50&quot;&gt;Line 50:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 50:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# From step 6, you have the individual namespaces used by the “sleep” container (no need to go inside the container again). Let’s check the network namespace (&amp;lt;tt&amp;gt;sudo nsenter -t &amp;lt;/tt&amp;gt;&amp;lt;pid&amp;gt;&amp;lt;tt&amp;gt; -n ip addr&amp;lt;/tt&amp;gt;).  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# From step 6, you have the individual namespaces used by the “sleep” container (no need to go inside the container again). Let’s check the network namespace (&amp;lt;tt&amp;gt;sudo nsenter -t &amp;lt;/tt&amp;gt;&amp;lt;pid&amp;gt;&amp;lt;tt&amp;gt; -n ip addr&amp;lt;/tt&amp;gt;).  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#: Note that uid remapping is not enabled by default. So the user (uid) inside the container will be the same outside (which does not consider security).&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#: Note that uid remapping is not enabled by default. So the user (uid) inside the container will be the same outside (which does not consider security).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Now, make your own Docker container. Read the current [https://raw.githubusercontent.com/docker-library/hello-world/7ecae6978055d2fb6960e2a29d24a2af612e2716/amd64/hello-world/Dockerfile Dockerfile of hello-world]. Change it in a way that it is no longer from scratch but &#039;&#039;from &amp;lt;tt&amp;gt;hello-world &amp;lt;/tt&amp;gt;&#039;&#039;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;, and runs &lt;/del&gt;&amp;lt;tt&amp;gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;/&lt;/del&gt;csimpleshell&amp;lt;/tt&amp;gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;after &lt;/del&gt;&amp;lt;tt&amp;gt;/hello&amp;lt;/tt&amp;gt;. Build a new image called &amp;lt;tt&amp;gt;csimpleshell&amp;lt;/tt&amp;gt; by doing the following:  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Now, make your own Docker container. Read the current [https://raw.githubusercontent.com/docker-library/hello-world/7ecae6978055d2fb6960e2a29d24a2af612e2716/amd64/hello-world/Dockerfile Dockerfile of hello-world]. Change it in a way that it is no longer from scratch but &#039;&#039;from &amp;lt;tt&amp;gt;hello-world &amp;lt;/tt&amp;gt;&#039;&#039;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;. Here we can avoid defining &lt;/ins&gt;&amp;lt;tt&amp;gt;csimpleshell&amp;lt;/tt&amp;gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;as the default command as it works with a terminal for interaction (then it will inherit &lt;/ins&gt;&amp;lt;tt&amp;gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;CMD&amp;lt;&lt;/ins&gt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&amp;gt; from &amp;lt;tt&amp;gt;&lt;/ins&gt;hello&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;-world&lt;/ins&gt;&amp;lt;/tt&amp;gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;)&lt;/ins&gt;. Build a new image called &amp;lt;tt&amp;gt;csimpleshell&amp;lt;/tt&amp;gt; by doing the following:  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#: &amp;lt;tt&amp;gt;mkdir anyname&amp;lt;/tt&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#: &amp;lt;tt&amp;gt;mkdir anyname&amp;lt;/tt&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#: copy your &amp;lt;tt&amp;gt;csimipleshell&amp;lt;/tt&amp;gt; and the Dockerfile of &amp;lt;tt&amp;gt;hello-world&amp;lt;/tt&amp;gt; into this directory&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#: copy your &amp;lt;tt&amp;gt;csimipleshell&amp;lt;/tt&amp;gt; and the Dockerfile of &amp;lt;tt&amp;gt;hello-world&amp;lt;/tt&amp;gt; into this directory&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l56&quot;&gt;Line 56:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 56:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#: make necessary changes to the Dockerfile&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#: make necessary changes to the Dockerfile&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#: &amp;lt;tt&amp;gt;docker build -t csimpleshell .&amp;lt;/tt&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#: &amp;lt;tt&amp;gt;docker build -t csimpleshell .&amp;lt;/tt&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Run the new csimpleshell container (e.g., &amp;lt;tt&amp;gt;docker run -it csimpleshell&amp;lt;/tt&amp;gt;). Depending on how you compiled csimpleshell, check whether the container runs or if it does whether csimpleshell works as before. Try compiling csimpleshell statically (if it was dynamic) and repeat the steps.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Run the new csimpleshell container (e.g., &amp;lt;tt&amp;gt;docker run -it &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;csimpleshell /&lt;/ins&gt;csimpleshell&amp;lt;/tt&amp;gt;). Depending on &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;tt&amp;gt;&lt;/ins&gt;how you compiled csimpleshell&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/tt&amp;gt;&lt;/ins&gt;, check whether the container runs or if it does whether csimpleshell works as before. Try compiling csimpleshell statically (if it was dynamic) and repeat the steps.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Edit the Dockerfile again and make it from “centos” instead of “hello-world”. Remove any reference to hello. Rebuild and run it. How is csimpleshell now? &amp;lt;u&amp;gt;Why&amp;lt;/u&amp;gt; is there such a difference?&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Edit the Dockerfile again and make it from “centos” instead of “hello-world”. Remove any reference to hello. Rebuild and run it. How is csimpleshell now? &amp;lt;u&amp;gt;Why&amp;lt;/u&amp;gt; is there such a difference?&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W22:_Tutorial_9&amp;diff=23958&amp;oldid=prev</id>
		<title>Lianyingzhao at 16:01, 25 March 2022</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W22:_Tutorial_9&amp;diff=23958&amp;oldid=prev"/>
		<updated>2022-03-25T16:01:50Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 16:01, 25 March 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l50&quot;&gt;Line 50:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 50:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# From step 6, you have the individual namespaces used by the “sleep” container (no need to go inside the container again). Let’s check the network namespace (&amp;lt;tt&amp;gt;sudo nsenter -t &amp;lt;/tt&amp;gt;&amp;lt;pid&amp;gt;&amp;lt;tt&amp;gt; -n ip addr&amp;lt;/tt&amp;gt;).  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# From step 6, you have the individual namespaces used by the “sleep” container (no need to go inside the container again). Let’s check the network namespace (&amp;lt;tt&amp;gt;sudo nsenter -t &amp;lt;/tt&amp;gt;&amp;lt;pid&amp;gt;&amp;lt;tt&amp;gt; -n ip addr&amp;lt;/tt&amp;gt;).  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#: Note that uid remapping is not enabled by default. So the user (uid) inside the container will be the same outside (which does not consider security).&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#: Note that uid remapping is not enabled by default. So the user (uid) inside the container will be the same outside (which does not consider security).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Now, make your own Docker container. Read the current Dockerfile of hello-world. Change it in a way that it is no longer from scratch but &#039;&#039;from &amp;lt;tt&amp;gt;hello-world &amp;lt;/tt&amp;gt;&#039;&#039;, and runs &amp;lt;tt&amp;gt;/csimpleshell&amp;lt;/tt&amp;gt; after &amp;lt;tt&amp;gt;/hello&amp;lt;/tt&amp;gt;. Build a new image called &amp;lt;tt&amp;gt;csimpleshell&amp;lt;/tt&amp;gt; by doing the following:  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Now, make your own Docker container. Read the current &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[https://raw.githubusercontent.com/docker-library/hello-world/7ecae6978055d2fb6960e2a29d24a2af612e2716/amd64/hello-world/Dockerfile &lt;/ins&gt;Dockerfile of hello-world&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]&lt;/ins&gt;. Change it in a way that it is no longer from scratch but &#039;&#039;from &amp;lt;tt&amp;gt;hello-world &amp;lt;/tt&amp;gt;&#039;&#039;, and runs &amp;lt;tt&amp;gt;/csimpleshell&amp;lt;/tt&amp;gt; after &amp;lt;tt&amp;gt;/hello&amp;lt;/tt&amp;gt;. Build a new image called &amp;lt;tt&amp;gt;csimpleshell&amp;lt;/tt&amp;gt; by doing the following:  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#: &amp;lt;tt&amp;gt;mkdir anyname&amp;lt;/tt&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#: &amp;lt;tt&amp;gt;mkdir anyname&amp;lt;/tt&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#: copy your &amp;lt;tt&amp;gt;csimipleshell&amp;lt;/tt&amp;gt; and the Dockerfile of &amp;lt;tt&amp;gt;hello-world&amp;lt;/tt&amp;gt; into this directory&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#: copy your &amp;lt;tt&amp;gt;csimipleshell&amp;lt;/tt&amp;gt; and the Dockerfile of &amp;lt;tt&amp;gt;hello-world&amp;lt;/tt&amp;gt; into this directory&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W22:_Tutorial_9&amp;diff=23957&amp;oldid=prev</id>
		<title>Lianyingzhao at 16:00, 25 March 2022</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W22:_Tutorial_9&amp;diff=23957&amp;oldid=prev"/>
		<updated>2022-03-25T16:00:44Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 16:00, 25 March 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l48&quot;&gt;Line 48:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 48:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Inside the container, use the command &amp;lt;tt&amp;gt;id&amp;lt;/tt&amp;gt; to see what user you’re logged in as (uid, gid and group). Then &amp;lt;tt&amp;gt;ps -eo uid,gid,pid,command | grep sleep&amp;lt;/tt&amp;gt; inside the container and outside the container respectively. Are their outputs the same?&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Inside the container, use the command &amp;lt;tt&amp;gt;id&amp;lt;/tt&amp;gt; to see what user you’re logged in as (uid, gid and group). Then &amp;lt;tt&amp;gt;ps -eo uid,gid,pid,command | grep sleep&amp;lt;/tt&amp;gt; inside the container and outside the container respectively. Are their outputs the same?&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Using the pid of “sleep” you have got outside the container above, find its pid namespace (&amp;lt;tt&amp;gt;sudo ls -l /proc/&amp;lt;pid&amp;gt;/ns/pid&amp;lt;/tt&amp;gt;, format &amp;lt;tt&amp;gt;pid:[????]&amp;lt;/tt&amp;gt;). Is it consistent with the &amp;lt;tt&amp;gt;lsns&amp;lt;/tt&amp;gt; output inside the container?&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Using the pid of “sleep” you have got outside the container above, find its pid namespace (&amp;lt;tt&amp;gt;sudo ls -l /proc/&amp;lt;pid&amp;gt;/ns/pid&amp;lt;/tt&amp;gt;, format &amp;lt;tt&amp;gt;pid:[????]&amp;lt;/tt&amp;gt;). Is it consistent with the &amp;lt;tt&amp;gt;lsns&amp;lt;/tt&amp;gt; output inside the container?&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# From step &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;7&lt;/del&gt;, you have the individual namespaces used by the “sleep” container (no need to go inside the container again). Let’s check the network namespace (&amp;lt;tt&amp;gt;sudo nsenter -t &amp;lt;/tt&amp;gt;&amp;lt;pid&amp;gt;&amp;lt;tt&amp;gt; -n ip addr&amp;lt;/tt&amp;gt;).  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# From step &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;6&lt;/ins&gt;, you have the individual namespaces used by the “sleep” container (no need to go inside the container again). Let’s check the network namespace (&amp;lt;tt&amp;gt;sudo nsenter -t &amp;lt;/tt&amp;gt;&amp;lt;pid&amp;gt;&amp;lt;tt&amp;gt; -n ip addr&amp;lt;/tt&amp;gt;).  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#: Note that uid remapping is not enabled by default. So the user (uid) inside the container will be the same outside (which does not consider security).&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#: Note that uid remapping is not enabled by default. So the user (uid) inside the container will be the same outside (which does not consider security).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Now, make your own Docker container. Read the current Dockerfile of hello-world. Change it in a way that it is no longer from scratch but &amp;#039;&amp;#039;from &amp;lt;tt&amp;gt;hello-world &amp;lt;/tt&amp;gt;&amp;#039;&amp;#039;, and runs &amp;lt;tt&amp;gt;/csimpleshell&amp;lt;/tt&amp;gt; after &amp;lt;tt&amp;gt;/hello&amp;lt;/tt&amp;gt;. Build a new image called &amp;lt;tt&amp;gt;csimpleshell&amp;lt;/tt&amp;gt; by doing the following:  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Now, make your own Docker container. Read the current Dockerfile of hello-world. Change it in a way that it is no longer from scratch but &amp;#039;&amp;#039;from &amp;lt;tt&amp;gt;hello-world &amp;lt;/tt&amp;gt;&amp;#039;&amp;#039;, and runs &amp;lt;tt&amp;gt;/csimpleshell&amp;lt;/tt&amp;gt; after &amp;lt;tt&amp;gt;/hello&amp;lt;/tt&amp;gt;. Build a new image called &amp;lt;tt&amp;gt;csimpleshell&amp;lt;/tt&amp;gt; by doing the following:  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W22:_Tutorial_9&amp;diff=23956&amp;oldid=prev</id>
		<title>Lianyingzhao: Created page with &quot;By the end of this tutorial, you will have a basic familiarity with the Docker platform and be able to run, operate, and customize containers, and create simple containers of your own. You will see how kernel building blocks like namespaces make containers possible.  Tutorials are graded based on participation and effort (&#039;&#039;&#039;so no need to try to have the “correct” answers — what matters is the process&#039;&#039;&#039;), but you should still turn in your work. Even if you have no...&quot;</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W22:_Tutorial_9&amp;diff=23956&amp;oldid=prev"/>
		<updated>2022-03-25T15:49:21Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;By the end of this tutorial, you will have a basic familiarity with the Docker platform and be able to run, operate, and customize containers, and create simple containers of your own. You will see how kernel building blocks like namespaces make containers possible.  Tutorials are graded based on participation and effort (&amp;#039;&amp;#039;&amp;#039;so no need to try to have the “correct” answers — what matters is the process&amp;#039;&amp;#039;&amp;#039;), but you should still turn in your work. Even if you have no...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;By the end of this tutorial, you will have a basic familiarity with the Docker platform and be able to run, operate, and customize containers, and create simple containers of your own. You will see how kernel building blocks like namespaces make containers possible.&lt;br /&gt;
&lt;br /&gt;
Tutorials are graded based on participation and effort (&amp;#039;&amp;#039;&amp;#039;so no need to try to have the “correct” answers — what matters is the process&amp;#039;&amp;#039;&amp;#039;), but you should still turn in your work. Even if you have no idea about certain tasks or disagree about something, still make sure to document your confusions/opinions that reflect your thinking about that task. Submit your answers on Brightspace as a single text file named &amp;quot;&amp;lt;username&amp;gt;-comp3000-t8.txt&amp;quot; (where username is your MyCarletonOne username). The first four lines of this file should be &amp;quot;COMP 3000 Tutorial 8&amp;quot;, your name, student number, and the date of submission. &lt;br /&gt;
&lt;br /&gt;
The deadline is usually four days after the tutorial date (see the actual due date and &amp;#039;&amp;#039;&amp;#039;time&amp;#039;&amp;#039;&amp;#039; on the submission entry). Note that the submission entry is enforced by the system, so you may fail to get the effort marks even if it is one minute past the deadline.&lt;br /&gt;
&lt;br /&gt;
You should also check in with your assigned TA online (by responding to the poll in the Teams channel tutorials-public or the private channel). Your TA will be your first point of contact when you have questions or encounter any issues during the tutorial session. &lt;br /&gt;
&lt;br /&gt;
You get 1.5 marks for submitting answers that shows your effort and 0.5 for checking in, making this tutorial worth 2 points total.&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
&lt;br /&gt;
===Docker containers===&lt;br /&gt;
Docker is one of the OS-level virtualization technologies that allows the creation of isolated virtual execution environments, called containers, sharing the same OS kernel and certain runtime services/libraries with other containers. The workload running inside a container will feel as if it had its own everything, OS kernel, root file system, etc. This is possible thanks to the way Docker containers are designed and implemented. The Linux kernel does not directly support the construction of containers (the userspace libraries do) but its various building blocks play an important role, among which we will cover namespaces in this tutorial.&lt;br /&gt;
&lt;br /&gt;
===Docker images===&lt;br /&gt;
A Docker image is a file containing a root file system as well as configuration parameters. It is very similar to other disk image formats in this sense. One of the main differences is that it employs a layered file system to maximize storage efficiency and allow flexible reuse of existing files.&lt;br /&gt;
 &lt;br /&gt;
===Dockerfile===&lt;br /&gt;
A Dockerfile is a text file and serves as instructions to build a Docker image. Unlike storing and distributing binary data directly in images, using Dockerfiles can save space and rebuild the Docker image by always downloading the latest version of software.&lt;br /&gt;
&lt;br /&gt;
===Docker Registry===&lt;br /&gt;
The Registry is a server-side application containing and managing repositories of Docker images. We use Docker Hub (among other choices by different providers) to pull images from in this tutorial.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
Namespaces allow for multiple “spaces” where identical names can coexist. For example, the same process ID (PID) may refer to completely different processes. This is like how we can distinguish Tom (PID) in Ottawa (namespace) from Tom in Toronto (namespace). Namespaces are enforced by the OS kernel. They are the fundamental building block of containers.&lt;br /&gt;
&lt;br /&gt;
A few namespaces we will cover here: Mount (&amp;lt;tt&amp;gt;mnt&amp;lt;/tt&amp;gt;), Network (&amp;lt;tt&amp;gt;net&amp;lt;/tt&amp;gt;), User ID (&amp;lt;tt&amp;gt;uid&amp;lt;/tt&amp;gt;) and Process ID (&amp;lt;tt&amp;gt;pid&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
You can use the command &amp;lt;tt&amp;gt;lsns&amp;lt;/tt&amp;gt; to see the namespaces the current process is in. A namespace ID is actually an &amp;#039;&amp;#039;&amp;#039;inode&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
 &lt;br /&gt;
Also, the command &amp;lt;tt&amp;gt;nsenter&amp;lt;/tt&amp;gt; allows you to run programs with namespaces of another process. Use the &amp;lt;tt&amp;gt;-t&amp;lt;/tt&amp;gt; option to specify the target PID. For instance, &amp;lt;tt&amp;gt;sudo nsenter -t 2772 -m ls /&amp;lt;/tt&amp;gt; will list the root file system of the mount namespace of process 2772.&lt;br /&gt;
&lt;br /&gt;
==Tasks/Questions==&lt;br /&gt;
The purpose of the following questions and tasks is to help you understand how containers work, which is an important artifact on top of and based on modern operating systems. The focus is on the OS building blocks – how it is made possible by the OS. Docker is just a typical and popular example to facilitate understanding. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;You need to &amp;lt;tt&amp;gt;sudo&amp;lt;/tt&amp;gt; for all the &amp;lt;tt&amp;gt;docker&amp;lt;/tt&amp;gt; commands below&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
Install Docker with &amp;lt;tt&amp;gt;sudo apt install docker.io&amp;lt;/tt&amp;gt; if it’s not already installed.&lt;br /&gt;
&lt;br /&gt;
# Use &amp;lt;tt&amp;gt;docker images&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;docker ps&amp;lt;/tt&amp;gt; (similar to the purpose of &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt;) to see what images you have and whether any containers are running. Run your first container with &amp;lt;tt&amp;gt;docker run hello-world&amp;lt;/tt&amp;gt;. Now, check the images and &amp;lt;tt&amp;gt;docker ps&amp;lt;/tt&amp;gt; again, what do you see and &amp;lt;u&amp;gt;why&amp;lt;/u&amp;gt;?&lt;br /&gt;
# Look at the hello-world image above and you may wonder how the tiny-sized image forms a full container. Find out where the files are located (hint: using the command &amp;lt;tt&amp;gt;docker inspect&amp;lt;/tt&amp;gt; and looking for paths starting with &amp;lt;tt&amp;gt;/var/lib/docker&amp;lt;/tt&amp;gt;). What is the size of the found file? Run the file directly. &amp;lt;u&amp;gt;What do you think&amp;lt;/u&amp;gt; is the way the tiny-sized image forms the full container?&lt;br /&gt;
# &amp;lt;tt&amp;gt;docker ps -a&amp;lt;/tt&amp;gt; will show something different. Next, let’s try an image of a bit more complexity that will remain running. Try the centos (a Linux distribution) image: &amp;lt;tt&amp;gt;docker run -d centos sleep infinity&amp;lt;/tt&amp;gt; (&amp;lt;tt&amp;gt;man docker-run&amp;lt;/tt&amp;gt; for the meaning of the options). &lt;br /&gt;
# Start a new shell: &amp;lt;tt&amp;gt;docker exec -it&amp;lt;/tt&amp;gt; &amp;lt;CONTAINER ID&amp;gt; &amp;lt;tt&amp;gt;/bin/bash&amp;lt;/tt&amp;gt; (you can find out the container ID with &amp;lt;tt&amp;gt;docker ps -a&amp;lt;/tt&amp;gt;. Note that you can specify just the first few digits of the ID as long as it’s distinctive). Explore the file system therein.&lt;br /&gt;
#; Next, we will examine the namespaces.&lt;br /&gt;
# Compare the mount namespaces (different views of the file system structure) between the centos container and the host, using &amp;lt;tt&amp;gt;ls -l /proc/self/ns/mnt&amp;lt;/tt&amp;gt;. Are they the same and if not, what are they (format: &amp;lt;tt&amp;gt;mnt:[????]&amp;lt;/tt&amp;gt;)? In particular, take a look at the root mount point (“&amp;lt;tt&amp;gt;/&amp;lt;/tt&amp;gt;”) inside and outside the container (&amp;lt;tt&amp;gt;mount | grep &amp;quot;on / &amp;quot;&amp;lt;/tt&amp;gt;). You can always use two sessions (one in the container and one in the host) or &amp;lt;tt&amp;gt;tmux&amp;lt;/tt&amp;gt; as you feel convenient.&lt;br /&gt;
# With the &amp;lt;tt&amp;gt;lsns&amp;lt;/tt&amp;gt; command, you can get an overview of all namespaces. Comparing the centos container and the host, &amp;lt;u&amp;gt;which namespaces are the same (shared) and which are different&amp;lt;/u&amp;gt;?&lt;br /&gt;
# Inside the container, use the command &amp;lt;tt&amp;gt;id&amp;lt;/tt&amp;gt; to see what user you’re logged in as (uid, gid and group). Then &amp;lt;tt&amp;gt;ps -eo uid,gid,pid,command | grep sleep&amp;lt;/tt&amp;gt; inside the container and outside the container respectively. Are their outputs the same?&lt;br /&gt;
# Using the pid of “sleep” you have got outside the container above, find its pid namespace (&amp;lt;tt&amp;gt;sudo ls -l /proc/&amp;lt;pid&amp;gt;/ns/pid&amp;lt;/tt&amp;gt;, format &amp;lt;tt&amp;gt;pid:[????]&amp;lt;/tt&amp;gt;). Is it consistent with the &amp;lt;tt&amp;gt;lsns&amp;lt;/tt&amp;gt; output inside the container?&lt;br /&gt;
# From step 7, you have the individual namespaces used by the “sleep” container (no need to go inside the container again). Let’s check the network namespace (&amp;lt;tt&amp;gt;sudo nsenter -t &amp;lt;/tt&amp;gt;&amp;lt;pid&amp;gt;&amp;lt;tt&amp;gt; -n ip addr&amp;lt;/tt&amp;gt;). &lt;br /&gt;
#: Note that uid remapping is not enabled by default. So the user (uid) inside the container will be the same outside (which does not consider security).&lt;br /&gt;
# Now, make your own Docker container. Read the current Dockerfile of hello-world. Change it in a way that it is no longer from scratch but &amp;#039;&amp;#039;from &amp;lt;tt&amp;gt;hello-world &amp;lt;/tt&amp;gt;&amp;#039;&amp;#039;, and runs &amp;lt;tt&amp;gt;/csimpleshell&amp;lt;/tt&amp;gt; after &amp;lt;tt&amp;gt;/hello&amp;lt;/tt&amp;gt;. Build a new image called &amp;lt;tt&amp;gt;csimpleshell&amp;lt;/tt&amp;gt; by doing the following: &lt;br /&gt;
#: &amp;lt;tt&amp;gt;mkdir anyname&amp;lt;/tt&amp;gt;&lt;br /&gt;
#: copy your &amp;lt;tt&amp;gt;csimipleshell&amp;lt;/tt&amp;gt; and the Dockerfile of &amp;lt;tt&amp;gt;hello-world&amp;lt;/tt&amp;gt; into this directory&lt;br /&gt;
#: &amp;lt;tt&amp;gt;cd anyname&amp;lt;/tt&amp;gt;&lt;br /&gt;
#: make necessary changes to the Dockerfile&lt;br /&gt;
#: &amp;lt;tt&amp;gt;docker build -t csimpleshell .&amp;lt;/tt&amp;gt;&lt;br /&gt;
# Run the new csimpleshell container (e.g., &amp;lt;tt&amp;gt;docker run -it csimpleshell&amp;lt;/tt&amp;gt;). Depending on how you compiled csimpleshell, check whether the container runs or if it does whether csimpleshell works as before. Try compiling csimpleshell statically (if it was dynamic) and repeat the steps.&lt;br /&gt;
# Edit the Dockerfile again and make it from “centos” instead of “hello-world”. Remove any reference to hello. Rebuild and run it. How is csimpleshell now? &amp;lt;u&amp;gt;Why&amp;lt;/u&amp;gt; is there such a difference?&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
</feed>