<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <title>svnscha - docker</title>
    <subtitle>automating annoying tasks, sharing tips, and embracing less frustration</subtitle>
    <link rel="self" type="application/atom+xml" href="https://svnscha.de/tags/docker/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://svnscha.de"/>
    <generator uri="https://astro.build/">Astro</generator>
    <updated>2025-10-10T00:00:00+00:00</updated>
    <id>https://svnscha.de/tags/docker/atom.xml</id>
    <entry xml:lang="en">
        <title>How to: Use Docker Remote Contexts with SSH</title>
        <published>2025-10-10T00:00:00+00:00</published>
        <updated>2025-10-10T00:00:00+00:00</updated>
        <author>
          <name>Sven Scharmentke</name>
        </author>
        <link rel="alternate" type="text/html" href="https://svnscha.de/posts/docker-remote-context/"/>
        <id>https://svnscha.de/posts/docker-remote-context/</id>
        <summary type="html">A simple and secure guide to configuring SSH-based Docker remote contexts for offloading resource-intensive Docker operations to a remote host while keeping your local environment lightweight.</summary>
        <content type="html" xml:base="https://svnscha.de/posts/docker-remote-context/">&lt;h2 id=&quot;the-problem-when-your-laptop-becomes-a-jet-engine&quot;&gt;The Problem: When Your Laptop Becomes a Jet Engine&lt;/h2&gt;
&lt;p&gt;Working on resource-intensive Docker projects often turns laptops into jet engines. The fans spin up, the CPU overheats, and performance degrades significantly. This is especially problematic when working with limited resources - lightweight laptops, VDI sessions, or simply wanting to preserve your hardware.&lt;/p&gt;
&lt;p&gt;An SSH-based Docker context keeps the development tools on your local machine while running Docker workloads on a more capable remote host. Your laptop stays responsive and the remote system handles the heavier work.&lt;/p&gt;
&lt;h2 id=&quot;step-1-prerequisites&quot;&gt;Step 1: Prerequisites&lt;/h2&gt;
&lt;p&gt;Before we start, ensure you have:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;SSH access configured&lt;/strong&gt; to your remote Docker host with a proper SSH config entry like:&lt;/li&gt;
&lt;/ol&gt;
&lt;pre class=&quot;astro-code dark-plus&quot; style=&quot;background-color:#1E1E1E;color:#D4D4D4; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;# ~/.ssh/config&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;Host docker-remote&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  HostName 10.10.10.10&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  IdentityFile ~/.ssh/id_rsa&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  User ubuntu&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;&lt;strong&gt;Your user is in the docker group&lt;/strong&gt; on the remote host:&lt;/li&gt;
&lt;/ol&gt;
&lt;pre class=&quot;astro-code dark-plus&quot; style=&quot;background-color:#1E1E1E;color:#D4D4D4; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; usermod&lt;/span&gt;&lt;span style=&quot;color:#569CD6&quot;&gt; -aG&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; docker&lt;/span&gt;&lt;span style=&quot;color:#9CDCFE&quot;&gt; $USER&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That's all the setup needed! Now let's create the Docker context.&lt;/p&gt;
&lt;h2 id=&quot;step-2-create-the-ssh-based-docker-context&quot;&gt;Step 2: Create the SSH-Based Docker Context&lt;/h2&gt;
&lt;p&gt;Creating the Docker context is incredibly simple when you have SSH properly configured.&lt;/p&gt;
&lt;h3 id=&quot;create-your-ssh-based-remote-context&quot;&gt;Create Your SSH-Based Remote Context&lt;/h3&gt;
&lt;p&gt;Create a new context using your SSH config host:&lt;/p&gt;
&lt;pre class=&quot;astro-code dark-plus&quot; style=&quot;background-color:#1E1E1E;color:#D4D4D4; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;docker&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; context&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; create&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; docker-remote&lt;/span&gt;&lt;span style=&quot;color:#569CD6&quot;&gt; --docker&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; host=ssh://docker-remote&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That's it! Docker will use your existing SSH configuration, including the hostname, user, and identity file you've already set up.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The beauty of this approach:&lt;/strong&gt; No daemon.json changes, no TCP configuration, no port forwarding, no firewall rules, no TLS certificate generation - just leverage your existing SSH security infrastructure. Simple and elegant!&lt;/p&gt;
&lt;h3 id=&quot;check-your-current-contexts&quot;&gt;Check Your Current Contexts&lt;/h3&gt;
&lt;p&gt;First, let's see what contexts you currently have:&lt;/p&gt;
&lt;pre class=&quot;astro-code dark-plus&quot; style=&quot;background-color:#1E1E1E;color:#D4D4D4; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;docker&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; context&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; ls&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You'll probably see something like:&lt;/p&gt;
&lt;pre class=&quot;astro-code dark-plus&quot; style=&quot;background-color:#1E1E1E;color:#D4D4D4; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;NAME              DESCRIPTION                               DOCKER ENDPOINT&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;default *         Current DOCKER_HOST based configuration   npipe:////./pipe/docker_engine&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;desktop-linux     Docker Desktop                            npipe:////./pipe/dockerDesktopLinuxEngine&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;desktop-windows   Docker Desktop                            npipe:////./pipe/dockerDesktopWindowsEngine&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;docker-remote                                               ssh://docker-remote&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;test-the-connection&quot;&gt;Test the Connection&lt;/h3&gt;
&lt;p&gt;Let's verify everything works:&lt;/p&gt;
&lt;pre class=&quot;astro-code dark-plus&quot; style=&quot;background-color:#1E1E1E;color:#D4D4D4; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;docker&lt;/span&gt;&lt;span style=&quot;color:#569CD6&quot;&gt; --context&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; docker-remote&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; container&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; ls&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you see your remote containers listed (or an empty list if none are running), congratulations! You're successfully connected to your remote Docker host via SSH.&lt;/p&gt;
&lt;h2 id=&quot;step-3-make-it-your-default-optional&quot;&gt;Step 3: Make It Your Default (Optional)&lt;/h2&gt;
&lt;p&gt;If you want to use the remote context by default, you can switch to it:&lt;/p&gt;
&lt;pre class=&quot;astro-code dark-plus&quot; style=&quot;background-color:#1E1E1E;color:#D4D4D4; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;docker&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; context&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; use&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; docker-remote&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now all your &lt;code&gt;docker&lt;/code&gt; commands will automatically use the remote host:&lt;/p&gt;
&lt;pre class=&quot;astro-code dark-plus&quot; style=&quot;background-color:#1E1E1E;color:#D4D4D4; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;docker&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; container&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; ls&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#6A9955&quot;&gt;# This now runs on your remote host!&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;environment-variable-override&quot;&gt;Environment Variable Override&lt;/h3&gt;
&lt;p&gt;For more granular control, you can also use the &lt;code&gt;DOCKER_CONTEXT&lt;/code&gt; environment variable:&lt;/p&gt;
&lt;pre class=&quot;astro-code dark-plus&quot; style=&quot;background-color:#1E1E1E;color:#D4D4D4; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#6A9955&quot;&gt;# Windows PowerShell&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#9CDCFE&quot;&gt;$env&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt;:DOCKER_CONTEXT = &lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt;&quot;docker-remote&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#6A9955&quot;&gt;# Linux/macOS&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#569CD6&quot;&gt;export&lt;/span&gt;&lt;span style=&quot;color:#9CDCFE&quot;&gt; DOCKER_CONTEXT&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#9CDCFE&quot;&gt;docker-remote&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This approach is particularly useful in CI/CD scenarios or when you want different shells to use different contexts.&lt;/p&gt;
&lt;h2 id=&quot;why-ssh-is-better&quot;&gt;Why SSH is Better&lt;/h2&gt;
&lt;p&gt;Using SSH for Docker remote contexts offers several advantages over TCP:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Security&lt;/strong&gt;: All communication is encrypted by default&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Authentication&lt;/strong&gt;: Leverages existing SSH keys and authentication methods&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;No daemon configuration&lt;/strong&gt;: No need to modify Docker daemon settings on the remote host&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Firewall friendly&lt;/strong&gt;: Uses standard SSH port (22)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Audit trail&lt;/strong&gt;: SSH logging provides better security monitoring&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;switching-between-contexts&quot;&gt;Switching Between Contexts&lt;/h2&gt;
&lt;p&gt;Need to switch back to local Docker for something? Easy:&lt;/p&gt;
&lt;pre class=&quot;astro-code dark-plus&quot; style=&quot;background-color:#1E1E1E;color:#D4D4D4; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#6A9955&quot;&gt;# List available contexts&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;docker&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; context&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; ls&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#6A9955&quot;&gt;# Switch to local Docker&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;docker&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; context&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; use&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; default&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#6A9955&quot;&gt;# Or use a specific context for one command&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;docker&lt;/span&gt;&lt;span style=&quot;color:#569CD6&quot;&gt; --context&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; default&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; container&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; ls&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;bonus-powershell-function-for-quick-context-switching&quot;&gt;Bonus: PowerShell Function for Quick Context Switching&lt;/h2&gt;
&lt;p&gt;Here's a handy PowerShell function to make switching contexts even easier. Add this to your PowerShell profile for instant remote Docker activation:&lt;/p&gt;
&lt;h3 id=&quot;edit-your-powershell-profile&quot;&gt;Edit Your PowerShell Profile&lt;/h3&gt;
&lt;p&gt;First, open your PowerShell profile for editing:&lt;/p&gt;
&lt;pre class=&quot;astro-code dark-plus&quot; style=&quot;background-color:#1E1E1E;color:#D4D4D4; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;powershell&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt;notepad &lt;/span&gt;&lt;span style=&quot;color:#9CDCFE&quot;&gt;$PROFILE&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If the file doesn't exist yet, PowerShell will ask if you want to create it - say yes.&lt;/p&gt;
&lt;h3 id=&quot;add-the-function&quot;&gt;Add the Function&lt;/h3&gt;
&lt;p&gt;Add this function to your profile:&lt;/p&gt;
&lt;pre class=&quot;astro-code dark-plus&quot; style=&quot;background-color:#1E1E1E;color:#D4D4D4; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;powershell&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#569CD6&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt; docker-remote-activate&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#9CDCFE&quot;&gt;    $env:DOCKER_CONTEXT&lt;/span&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt; = &lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt;&quot;docker-remote&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;    Write-Host&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; &quot;Docker context switched to remote host&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Replace &lt;code&gt;&quot;docker-remote&quot;&lt;/code&gt; with whatever you named your remote context.&lt;/p&gt;
&lt;h3 id=&quot;save-and-reload&quot;&gt;Save and Reload&lt;/h3&gt;
&lt;p&gt;Save the file and reload your PowerShell profile:&lt;/p&gt;
&lt;pre class=&quot;astro-code dark-plus&quot; style=&quot;background-color:#1E1E1E;color:#D4D4D4; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;powershell&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt;. &lt;/span&gt;&lt;span style=&quot;color:#9CDCFE&quot;&gt;$PROFILE&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;usage&quot;&gt;Usage&lt;/h3&gt;
&lt;p&gt;Now you can instantly activate remote Docker in any PowerShell session:&lt;/p&gt;
&lt;pre class=&quot;astro-code dark-plus&quot; style=&quot;background-color:#1E1E1E;color:#D4D4D4; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;powershell&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#6A9955&quot;&gt;# Activate remote Docker for this session only&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt;docker-remote-activate&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#6A9955&quot;&gt;# Now all Docker commands run remotely&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt;docker ps&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt;docker images&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt;docker build .&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The beauty of this approach is that it only affects the current PowerShell session - open a new terminal window and you're back to local Docker by default!&lt;/p&gt;
&lt;h3 id=&quot;global-vs-terminal-specific-context-switching&quot;&gt;Global vs Terminal-Specific Context Switching&lt;/h3&gt;
&lt;p&gt;You have two ways to switch between local and remote Docker contexts:&lt;/p&gt;
&lt;h4 id=&quot;global-context-switching&quot;&gt;Global Context Switching&lt;/h4&gt;
&lt;p&gt;Affects all terminals system-wide:&lt;/p&gt;
&lt;pre class=&quot;astro-code dark-plus&quot; style=&quot;background-color:#1E1E1E;color:#D4D4D4; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#6A9955&quot;&gt;# Switch globally to remote&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;docker&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; context&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; use&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; docker-remote&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#6A9955&quot;&gt;# Switch back to local&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DCDCAA&quot;&gt;docker&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; context&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; use&lt;/span&gt;&lt;span style=&quot;color:#CE9178&quot;&gt; default&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id=&quot;terminal-specific-context&quot;&gt;Terminal-Specific Context&lt;/h4&gt;
&lt;p&gt;Affects only the current terminal session:&lt;/p&gt;
&lt;pre class=&quot;astro-code dark-plus&quot; style=&quot;background-color:#1E1E1E;color:#D4D4D4; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;powershell&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#6A9955&quot;&gt;# Terminal 1: Remote context&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt;docker-remote-activate&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt;docker ps  &lt;/span&gt;&lt;span style=&quot;color:#6A9955&quot;&gt;# runs remotely&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#6A9955&quot;&gt;# Terminal 2: Still local context  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#D4D4D4&quot;&gt;docker ps  &lt;/span&gt;&lt;span style=&quot;color:#6A9955&quot;&gt;# runs locally&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Whether you prefer global context switching or terminal-specific control, Docker remote contexts give you the flexibility to work exactly how you want.&lt;/p&gt;
&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;
&lt;p&gt;Using SSH-based Docker remote contexts provides a secure, simple solution for offloading resource-intensive Docker operations to remote hosts. With just a single command and proper SSH configuration, you can transform your development workflow without compromising security.&lt;/p&gt;
&lt;p&gt;The SSH approach eliminates the complexity of daemon configuration while providing enterprise-grade security through encrypted communication and existing authentication infrastructure.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Key Benefits:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Secure by default (encrypted communication)&lt;/li&gt;
&lt;li&gt;No daemon configuration required&lt;/li&gt;
&lt;li&gt;Uses standard SSH authentication&lt;/li&gt;
&lt;li&gt;Works with existing SSH infrastructure&lt;/li&gt;
&lt;li&gt;Simple one-command setup&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.docker.com/engine/manage-resources/contexts/&quot;&gt;Docker Context Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.docker.com/engine/context/remote/&quot;&gt;Docker SSH Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.ssh.com/academy/ssh/public-key-authentication&quot;&gt;SSH Key Authentication&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
    </entry>
</feed>
