<?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_F23%3A_Tutorial_9</id>
	<title>COMP3000 Operating Systems F23: 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_F23%3A_Tutorial_9"/>
	<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_F23:_Tutorial_9&amp;action=history"/>
	<updated>2026-06-02T19:43:49Z</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_F23:_Tutorial_9&amp;diff=24585&amp;oldid=prev</id>
		<title>Abdou at 02:11, 25 October 2023</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_F23:_Tutorial_9&amp;diff=24585&amp;oldid=prev"/>
		<updated>2023-10-25T02:11:57Z</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 02:11, 25 October 2023&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-l18&quot;&gt;Line 18:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 18:&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;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;/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;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;/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;A few namespaces we will cover here: Mount (&amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;mnt&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;), Network (&amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;net&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;), User ID (&amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;uid&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;) and Process ID (&amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;pid&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&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;A few namespaces we will cover here: Mount (&amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;mnt&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;), Network (&amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;net&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;), User ID (&amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;uid&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;) and Process ID (&amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;pid&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&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;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;You can use the command &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;lsns&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; to see the namespaces the current process is in. A namespace ID is actually an &#039;&#039;&#039;inode&#039;&#039;&#039;.  &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;You can use the command &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;lsns&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; to see the namespaces the current process is in. A namespace ID is actually an &#039;&#039;&#039;inode&#039;&#039;&#039;.  &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;   &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;   &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;Also, the command &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;nsenter&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; allows you to run programs with namespaces of another process. Use the &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;-t&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; option to specify the target PID. For instance, &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;sudo nsenter -t 2772 -m ls /&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; will list the root file system of the mount namespace of process 2772.&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;Also, the command &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;nsenter&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; allows you to run programs with namespaces of another process. Use the &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;-t&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; option to specify the target PID. For instance, &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;sudo nsenter -t 2772 -m ls /&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; will list the root file system of the mount namespace of process 2772.&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;==Tasks/Questions==&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;==Tasks/Questions==&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;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;/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 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;/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;&#039;&#039;&#039;You need to &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;sudo&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; for all the &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;docker&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; commands below&#039;&#039;&#039;.&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;&#039;&#039;&#039;You need to &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;sudo&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; for all the &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;docker&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; commands below&#039;&#039;&#039;.&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;Install Docker with &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;sudo apt install docker.io&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; if it’s not already installed.&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;Install Docker with &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;sudo apt install docker.io&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; if it’s not already installed.&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;# Use &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;docker images&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; and &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;docker ps&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; (similar to the purpose of &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;ps&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;) to see what images you have and whether any containers are running. Run your first container with &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;docker run hello-world&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;. Now, check the images and &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;docker ps&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; again, what do you see and &amp;lt;u&amp;gt;why&amp;lt;/u&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;# Use &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;docker images&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; and &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;docker ps&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; (similar to the purpose of &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;ps&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;) to see what images you have and whether any containers are running. Run your first container with &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;docker run hello-world&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;. Now, check the images and &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;docker ps&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; again, what do you see and &amp;lt;u&amp;gt;why&amp;lt;/u&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;# 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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;docker inspect&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; and looking for paths starting with &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;/var/lib/docker&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&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;/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;# 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;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;docker inspect&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; and looking for paths starting with &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;/var/lib/docker&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&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;/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;# &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;docker ps -a&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;docker run -d centos sleep infinity&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; (&amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;man docker-run&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; for the meaning of the options).  &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;# &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;docker ps -a&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&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;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;docker run -d centos sleep infinity&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; (&amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;man docker-run&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; for the meaning of the options).  &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;# Start a new shell: &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;docker exec -it&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; &amp;lt;CONTAINER ID&amp;gt; &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;/bin/bash&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; (you can find out the container ID with &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;docker ps -a&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&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;/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;# Start a new shell: &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;docker exec -it&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; &amp;lt;CONTAINER ID&amp;gt; &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;/bin/bash&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; (you can find out the container ID with &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;docker ps -a&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&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;/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;#; Next, we will examine the namespaces.&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;#; Next, we will examine the namespaces.&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;# Compare the mount namespaces (different views of the file system structure) between the centos container and the host, using &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;ls -l /proc/self/ns/mnt&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;. Are they the same and if not, what are they (format: &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;mnt:[????]&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;)? In particular, take a look at the root mount point (“&amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;/&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;”) inside and outside the container (&amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;mount | grep &quot;on / &quot;&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;). You can always use two sessions (one in the container and one in the host) or &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;tmux&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; as you feel convenient.&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;# Compare the mount namespaces (different views of the file system structure) between the centos container and the host, using &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;ls -l /proc/self/ns/mnt&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;. Are they the same and if not, what are they (format: &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;mnt:[????]&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;)? In particular, take a look at the root mount point (“&amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;/&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;”) inside and outside the container (&amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;mount | grep &quot;on / &quot;&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;). You can always use two sessions (one in the container and one in the host) or &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;tmux&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; as you feel convenient.&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;# With the &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;lsns&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&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;/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;# With the &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;lsns&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&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;/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;# Inside the container, use the command &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;id&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; to see what user you’re logged in as (uid, gid and group). Then &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;ps -eo uid,gid,pid,command | grep sleep&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&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; 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;# Inside the container, use the command &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;id&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; to see what user you’re logged in as (uid, gid and group). Then &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;ps -eo uid,gid,pid,command | grep sleep&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&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; 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;# Using the pid of “sleep” you have got outside the container above, find its pid namespace (&amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;sudo ls -l /proc/&amp;lt;pid&amp;gt;/ns/pid&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;, format &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;pid:[????]&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;). Is it consistent with the &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;lsns&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; output inside the container?&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;# Using the pid of “sleep” you have got outside the container above, find its pid namespace (&amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;sudo ls -l /proc/&amp;lt;pid&amp;gt;/ns/pid&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;, format &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;pid:[????]&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;). Is it consistent with the &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;lsns&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&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 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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;sudo nsenter -t &amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;&amp;lt;pid&amp;gt;&amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; -n ip addr&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&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 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;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;sudo nsenter -t &amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;&amp;lt;pid&amp;gt;&amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; -n ip addr&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;hello-world &amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;&#039;&#039;. Here we can avoid defining &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;csimpleshell&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; as the default command as it works with a terminal for interaction (then it will inherit &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;CMD&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; from &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;hello-world&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;). Build a new image called &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;csimpleshell&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&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;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;hello-world &amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;&#039;&#039;. Here we can avoid defining &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;csimpleshell&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; as the default command as it works with a terminal for interaction (then it will inherit &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;CMD&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; from &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;hello-world&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;). Build a new image called &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;csimpleshell&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&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; 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;#: &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;mkdir anyname&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&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;#: &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;mkdir anyname&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&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;#: copy your &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;csimipleshell&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; and the Dockerfile of &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;hello-world&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; into this directory&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;#: copy your &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;csimipleshell&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; and the Dockerfile of &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;hello-world&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; into this directory&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;#: &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;cd anyname&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&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;#: &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;cd anyname&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&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;#: 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; 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;#: &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;docker build -t csimpleshell .&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&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;#: &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;docker build -t csimpleshell .&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;docker run -it csimpleshell /csimpleshell&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;). Depending on &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;how you compiled csimpleshell&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;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;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;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;docker run -it csimpleshell /csimpleshell&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;). Depending on &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;how you compiled csimpleshell&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;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>Abdou</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_F23:_Tutorial_9&amp;diff=24584&amp;oldid=prev</id>
		<title>Abdou: /* General Instructions (same for all tutorials) */</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_F23:_Tutorial_9&amp;diff=24584&amp;oldid=prev"/>
		<updated>2023-10-25T02:09:06Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;General Instructions (same for all tutorials)&lt;/span&gt;&lt;/span&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 02:09, 25 October 2023&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; 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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;==General Instructions (same for all tutorials)==&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;div class=&quot;mw-collapsible mw-collapsed&quot;&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Click on Expand to view.&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;div class=&quot;mw-collapsible-content&quot;&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Tutorials are graded based on participation and effort (&#039;&#039;&#039;so no need to struggle to have the “correct” answers — what matters is the attempts and sufficient thinking reflected in your answers&#039;&#039;&#039;), but you should still turn in your work. Submit your answers on Brightspace as a single text file named &quot;&amp;lt;username&amp;gt;-comp3000-t&amp;lt;n&amp;gt;.txt&quot; (where username is your MyCarletonOne username and n is the tutorial number). The first four lines of this file should be &quot;COMP 3000 Tutorial &amp;lt;n&amp;gt;&quot;, your name, student number, and the date of submission. Your submitted answers must at least respond to all the items in the &#039;&#039;&#039;Tasks/Questions&#039;&#039;&#039; section.&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;The deadline is usually four days after the tutorial date (see the actual deadline 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;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;You should also check in with your assigned TA (in person or by responding to a poll if online). Your TA will be your first point of contact when you have questions or encounter any issues during the tutorial session. &lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&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;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Read through the instructions before starting your work to get an overall picture. When source files are needed, you can download them by clicking on the hyperlink.&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/div&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/div&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&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;==Background==&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;==Background==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Abdou</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_F23:_Tutorial_9&amp;diff=24583&amp;oldid=prev</id>
		<title>Abdou: 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.  ==General Instructions (same for all tutorials)==  &lt;div class=&quot;mw-collapsible mw-collapsed&quot;&gt; Click on Expand to view. &lt;div class=&quot;mw-collapsible-content&quot;&gt; Tutorials are graded based on participation and effo...&quot;</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_F23:_Tutorial_9&amp;diff=24583&amp;oldid=prev"/>
		<updated>2023-10-25T02:09:00Z</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.  ==General Instructions (same for all tutorials)==  &amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot;&amp;gt; Click on Expand to view. &amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt; Tutorials are graded based on participation and effo...&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;
==General Instructions (same for all tutorials)==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Click on Expand to view.&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
Tutorials are graded based on participation and effort (&amp;#039;&amp;#039;&amp;#039;so no need to struggle to have the “correct” answers — what matters is the attempts and sufficient thinking reflected in your answers&amp;#039;&amp;#039;&amp;#039;), but you should still turn in your work. Submit your answers on Brightspace as a single text file named &amp;quot;&amp;lt;username&amp;gt;-comp3000-t&amp;lt;n&amp;gt;.txt&amp;quot; (where username is your MyCarletonOne username and n is the tutorial number). The first four lines of this file should be &amp;quot;COMP 3000 Tutorial &amp;lt;n&amp;gt;&amp;quot;, your name, student number, and the date of submission. Your submitted answers must at least respond to all the items in the &amp;#039;&amp;#039;&amp;#039;Tasks/Questions&amp;#039;&amp;#039;&amp;#039; section.&lt;br /&gt;
&lt;br /&gt;
The deadline is usually four days after the tutorial date (see the actual deadline 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 (in person or by responding to a poll if online). 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;
Read through the instructions before starting your work to get an overall picture. When source files are needed, you can download them by clicking on the hyperlink.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&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 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;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 [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 &amp;#039;&amp;#039;from &amp;lt;tt&amp;gt;hello-world &amp;lt;/tt&amp;gt;&amp;#039;&amp;#039;. Here we can avoid defining &amp;lt;tt&amp;gt;csimpleshell&amp;lt;/tt&amp;gt; as the default command as it works with a terminal for interaction (then it will inherit &amp;lt;tt&amp;gt;CMD&amp;lt;/tt&amp;gt; from &amp;lt;tt&amp;gt;hello-world&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 /csimpleshell&amp;lt;/tt&amp;gt;). Depending on &amp;lt;tt&amp;gt;how you compiled csimpleshell&amp;lt;/tt&amp;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;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>Abdou</name></author>
	</entry>
</feed>