<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Docker on D. Sébastien Taggart</title>
    <link>https://www.sebastientaggart.com/tags/docker/</link>
    <description>Recent content in Docker on D. Sébastien Taggart</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Sun, 04 Oct 2026 22:13:05 -0400</lastBuildDate>
    <atom:link href="https://www.sebastientaggart.com/tags/docker/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>How to Install Docker on Amazon Linux 2</title>
      <link>https://www.sebastientaggart.com/writing/installing-docker-on-amazon-linux2/</link>
      <pubDate>Thu, 30 Jan 2020 12:27:22 -0500</pubDate>
      <guid>https://www.sebastientaggart.com/writing/installing-docker-on-amazon-linux2/</guid>
      <description>&lt;p&gt;Installing Docker on Amazon Linux 2 is a straightforward process that opens up a world of possibilities for containerization. Let’s dive into the steps, ensuring you have a smooth experience from start to finish.&lt;/p&gt;
&lt;h3 id=&#34;step-1-update-your-system&#34;&gt;Step 1: Update Your System&lt;/h3&gt;
&lt;p&gt;First things first: you want to make sure your system is up to date. Run the following command to perform a quick update:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo yum update -y
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;step-2-install-docker&#34;&gt;Step 2: Install Docker&lt;/h3&gt;
&lt;p&gt;Once your system is prepped, installing Docker is as simple as executing:&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>Installing Docker on Amazon Linux 2 is a straightforward process that opens up a world of possibilities for containerization. Let’s dive into the steps, ensuring you have a smooth experience from start to finish.</p>
<h3 id="step-1-update-your-system">Step 1: Update Your System</h3>
<p>First things first: you want to make sure your system is up to date. Run the following command to perform a quick update:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo yum update -y
</span></span></code></pre></div><h3 id="step-2-install-docker">Step 2: Install Docker</h3>
<p>Once your system is prepped, installing Docker is as simple as executing:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo yum install -y docker
</span></span></code></pre></div><h3 id="step-3-configure-user-permissions">Step 3: Configure User Permissions</h3>
<p>To streamline your workflow, it’s beneficial to add the <code>ec2-user</code> to the Docker group. This allows you to run Docker commands without needing to prefix them with <code>sudo</code>. Just remember: after making this change, log out and log back in for it to take effect.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo usermod -a -G docker ec2-user
</span></span></code></pre></div><h3 id="step-4-enable-and-start-docker-service">Step 4: Enable and Start Docker Service</h3>
<p>Now, let’s ensure that Docker starts automatically upon system boot and then initiate the service:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo systemctl <span class="nb">enable</span> docker
</span></span><span class="line"><span class="cl">sudo service docker start
</span></span></code></pre></div><h3 id="step-5-verify-your-installation">Step 5: Verify Your Installation</h3>
<p>To confirm that Docker is running as expected, you can check the version and list any running containers with the following commands:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">docker -v
</span></span><span class="line"><span class="cl">docker ps -a
</span></span></code></pre></div><p>You should see output similar to this:</p>
<pre tabindex="0"><code>[ec2-user@ip-172-27-0-223 ~]$ docker -v
Docker version 18.09.9-ce, build 039a7df
[ec2-user@ip-172-27-0-223 ~]$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
[ec2-user@ip-172-27-0-223 ~]$
</code></pre><h3 id="important-note">Important Note</h3>
<p>Keep in mind that Amazon Linux tends to ship with an older version of the Docker engine. At the time of this writing, the latest Docker version is <code>19.03</code>, while Amazon&rsquo;s package offers <code>18.09</code>. This disparity could affect certain features or compatibility, so always check the version you need for your projects.</p>
<h2 id="step-6-install-docker-compose">Step 6: Install Docker Compose</h2>
<p>If you&rsquo;re looking to manage multi-container Docker applications, Docker Compose is your friend. You can install it using the following command:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo curl -L <span class="s2">&#34;https://github.com/docker/compose/releases/download/1.25.3/docker-compose-</span><span class="k">$(</span>uname -s<span class="k">)</span><span class="s2">-</span><span class="k">$(</span>uname -m<span class="k">)</span><span class="s2">&#34;</span> -o /usr/local/bin/docker-compose <span class="o">&amp;&amp;</span> sudo chmod +x /usr/local/bin/docker-compose
</span></span></code></pre></div><h3 id="wrapping-up">Wrapping Up</h3>
<p>Congratulations! You now have Docker (and optionally Docker Compose) installed on your Amazon Linux 2 instance. This setup will empower you to build, ship, and run applications in containers, enhancing your workflows and development processes.</p>
<p>As you embark on this journey with Docker, remember: every container you create is a step towards a more efficient and modernized infrastructure. Happy containerizing!</p>
]]></content:encoded>
    </item>
    <item>
      <title>How to Forward SSH Port Using UFW/Iptables</title>
      <link>https://www.sebastientaggart.com/writing/iptables-forward-default-ssh/</link>
      <pubDate>Sat, 04 Jan 2020 21:11:38 -0500</pubDate>
      <guid>https://www.sebastientaggart.com/writing/iptables-forward-default-ssh/</guid>
      <description>How to forward the default SSH port from the public internet to an internal containerized service.</description>
      <content:encoded><![CDATA[<p>When managing self-hosted services like Git, you may find yourself needing to forward non-standard ports—say, <code>:10022</code>. This could lead to a Git address that looks like <code>ssh://git@git.sebastientaggart.com:10022/sebastientaggart/my-project.git</code>. While this setup can function smoothly, using a non-standard port comes with its own set of challenges: public networks might block those ports, you’ll need more extensive documentation, and let’s be honest—non-standard ports can detract from the overall aesthetic of your URLs.</p>
<p>In this guide, we’ll focus on how to utilize <code>ufw</code> (Uncomplicated Firewall) to forward traffic from a standard SSH port (<code>:22</code>) on one server to a non-standard port on another. Think of this as setting up a traffic cop for your network, ensuring that requests get to their intended destination without unnecessary fuss.</p>
<h3 id="setting-up-port-forwarding">Setting Up Port Forwarding</h3>
<p>Start by editing the <code>before.rules</code> file for <code>ufw</code>:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo vi /etc/ufw/before.rules
</span></span></code></pre></div><p>Add the following lines to the file:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">*nat
</span></span><span class="line"><span class="cl">:PREROUTING ACCEPT <span class="o">[</span>0:0<span class="o">]</span>
</span></span><span class="line"><span class="cl">:POSTROUTING ACCEPT <span class="o">[</span>0:0<span class="o">]</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Forward traffic from this server (1.1.1.1:22) to a remote server (2.2.2.2:10022)</span>
</span></span><span class="line"><span class="cl">-A PREROUTING -i eth0 -d 1.1.1.1 -p tcp --dport <span class="m">22</span> -j DNAT --to-destination 2.2.2.2:10022
</span></span><span class="line"><span class="cl">-A POSTROUTING -o eth0 -j MASQUERADE
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">COMMIT
</span></span></code></pre></div><p>Replace <code>1.1.1.1</code> with the IP address of your server, and <code>2.2.2.2</code> with the IP of the target server.</p>
<p>After making these changes, reload <code>ufw</code> to apply the new rules:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo systemctl restart ufw
</span></span></code></pre></div><p>To ensure everything is functioning as intended, verify your settings with:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo iptables -t nat -L -n -v
</span></span></code></pre></div><p>Once you’ve completed these steps, your port <code>:22</code> will successfully forward to <code>:10022</code> on the remote server. Your Git addresses will now appear as follows: <code>ssh://git@git.sebastientaggart.com/sebastientaggart/my-project.git</code>.</p>
<h3 id="modifying-existing-rules">Modifying Existing Rules</h3>
<p>Now, what if you need to tweak existing rules? Flushing all iptables rules with <code>sudo iptables -F</code> is often too blunt an instrument; it can wreak havoc on your setup. Instead, it’s wiser to list your existing rules and delete them one by one as necessary.</p>
<p>To do this, list your current NAT rules with:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">iptables -t nat --line-numbers -L -n -v
</span></span></code></pre></div><p>The <code>--line-numbers</code> option is crucial, as it allows you to reference specific rules when you want to delete them. For example, if you want to remove the second rule in the <code>PREROUTING</code> chain, you’d issue:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">iptables -t nat -D PREROUTING <span class="m">2</span>
</span></span></code></pre></div><p>Remember, the instructions above assume you&rsquo;re adding rules to <code>/etc/ufw/before.rules</code> for the first time. If modifications are necessary, be sure to remove the old rules using the <code>-D</code> option before restarting <code>ufw</code> with <code>systemctl</code>.</p>
<h3 id="in-closing">In Closing</h3>
<p>By following these steps, you can seamlessly forward SSH ports using <code>ufw</code> and ensure that your self-hosted services run smoothly. Embracing a standard like port <code>:22</code> can simplify access and improve the security posture of your applications. After all, clarity in technology often leads to enhanced usability—and who doesn’t appreciate that?</p>
]]></content:encoded>
    </item>
  </channel>
</rss>
