<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Claude | no dogma blog</title><link>https://nodogmablog.bryanhogan.net/tag/claude/</link><atom:link href="https://nodogmablog.bryanhogan.net/tag/claude/index.xml" rel="self" type="application/rss+xml"/><description>Claude</description><generator>Wowchemy (https://wowchemy.com)</generator><language>en-us</language><lastBuildDate>Fri, 26 Jun 2026 00:00:00 +0000</lastBuildDate><image><url>https://nodogmablog.bryanhogan.net/media/icon_hu9c23d68d4e9f1f9acfa8237e5c2ea674_3344_512x512_fill_lanczos_center_3.png</url><title>Claude</title><link>https://nodogmablog.bryanhogan.net/tag/claude/</link></image><item><title>Claude Code in a Container</title><link>https://nodogmablog.bryanhogan.net/2026/06/claude-code-in-a-container/</link><pubDate>Fri, 26 Jun 2026 00:00:00 +0000</pubDate><guid>https://nodogmablog.bryanhogan.net/2026/06/claude-code-in-a-container/</guid><description>&lt;p>There are a lot of opinions about running Claude Code and other AI tools on your personal computer. Some are in favor, some against.&lt;/p>
&lt;p>I don&amp;rsquo;t want to do it, I want Claude isolated away from my personal files.&lt;/p>
&lt;p>One option is to create a full virtual machine, this is heavy, and will be slower to start and use.&lt;/p>
&lt;p>A faster, lighter option is to use a Docker container. It is extremely fast to start, as quick as opening a terminal. All of my changes are saved to a Docker volume, and I mount a directory from my host computer into the container so I can easily access the source code on my host computer.&lt;/p>
&lt;p>It is a relatively simple process, even if you don&amp;rsquo;t know much about Docker the instructions here should be easy to follow.&lt;/p>
&lt;p>Here is the &lt;code>Dockerfile&lt;/code> I use. You can, of course, choose a different base image, but using Alpine with the .NET SDK suits me. I have inline.&lt;/p>
&lt;pre tabindex="0">&lt;code class="language-black" data-lang="black">FROM mcr.microsoft.com/dotnet/sdk:10.0-alpine
WORKDIR /root # Set the working directory inside the container
RUN apk update &amp;amp;&amp;amp; apk upgrade # Update package lists and upgrade installed packages
RUN apk add bash # Install bash shell
RUN curl -fsSL https://claude.ai/install.sh | bash # Install Claude Code
RUN echo &amp;#34;PATH=$PATH:/root/.local/bin&amp;#34; &amp;gt;&amp;gt; .bashrc &amp;amp;&amp;amp; chmod 700 .bashrc # Add Claude Code to PATH in .bashrc and set permissions
ENTRYPOINT [ &amp;#34;bash&amp;#34; ] # Set the default command to bash&lt;/code>&lt;/pre>
&lt;p>To build this Docker image, run the following command in the same directory as the Dockerfile -
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-cfg" data-lang="cfg">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#000">docker build -t claude_with_dotnet .&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/p>
&lt;p>Before you start the container, you need to decide which directory on your host computer you want to mount into the container. This is where you will store the files that you want to access from inside the container. I have a specific directory for Claude generated applications &lt;code>/home/bryan/dev/claude&lt;/code>.&lt;/p>
&lt;p>In Docker Desktop, go to Settings &amp;gt; Resources &amp;gt; File sharing and add the directory you want to mount into the container. This is required for Docker to allow access to that directory.&lt;/p>
&lt;figure id="figure-add-directory-to-share-with-container">
&lt;div class="d-flex justify-content-center">
&lt;div class="w-100" >&lt;img alt="Add directory to share with container" srcset="
/2026/06/claude-code-in-a-container/media/docker_resources_hu94f9fc0b9a5f595f0af42ffa90cba6c2_143517_ad99af73c3374d5632733169724bc5e6.webp 400w,
/2026/06/claude-code-in-a-container/media/docker_resources_hu94f9fc0b9a5f595f0af42ffa90cba6c2_143517_b55e5997f27940f5a97b5d673a976001.webp 760w,
/2026/06/claude-code-in-a-container/media/docker_resources_hu94f9fc0b9a5f595f0af42ffa90cba6c2_143517_1200x1200_fit_q75_h2_lanczos_3.webp 1200w"
src="https://nodogmablog.bryanhogan.net/2026/06/claude-code-in-a-container/media/docker_resources_hu94f9fc0b9a5f595f0af42ffa90cba6c2_143517_ad99af73c3374d5632733169724bc5e6.webp"
width="760"
height="390"
loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;figcaption>
Add directory to share with container
&lt;/figcaption>&lt;/figure>
&lt;p>Now all that is left is to run the container; there is quite a bit to the command.&lt;/p>
&lt;pre tabindex="0">&lt;code class="language-black" data-lang="black">docker run -it --rm \
--volume claude_with_dotnet_vol:/root \
--mount type=bind,source=/home/bryan/dev/claude/,target=/root/dev \
claude_with_dotnet&lt;/code>&lt;/pre>
&lt;ul>
&lt;li>&lt;code>-it&lt;/code> - runs the container in interactive mode with a terminal attached.&lt;/li>
&lt;li>&lt;code>--rm&lt;/code> - removes the container when it exits. This is optional, as the things I change in &lt;code>/root&lt;/code> are saved to the Docker volume, so I don&amp;rsquo;t need to keep the container around.&lt;/li>
&lt;li>&lt;code>--volume claude_with_dotnet_vol:/root&lt;/code> - this creates a Docker volume to store the &lt;code>/root&lt;/code> directory from the container. This is where Claude Code and anything I will work on will be stored. The volume is created the first time you run the container.&lt;/li>
&lt;li>&lt;code>--mount type=bind,source=/home/bryan/dev/claude/,target=/root/dev&lt;/code> - this mounts the directory &lt;code>/home/bryan/dev/claude/&lt;/code> from my host computer into the container at &lt;code>/root/dev&lt;/code>. This is where I will use Claude to generate code, and I can easily access it from my host computer.&lt;/li>
&lt;/ul>
&lt;p>Here it is as a single line -
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-cfg" data-lang="cfg">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#000">docker run -it --rm --volume claude_with_dotnet_vol:/root --mount type&lt;/span>=&lt;span style="color:#5a2">bind,source=/home/bryan/dev/claude/,target=/root/dev claude_with_dotnet&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/p>
&lt;br/>
Whoomp, there it is!
&lt;figure id="figure-claude-running-in-a-container-running-in-a-terminal-running-in-vs-code">
&lt;div class="d-flex justify-content-center">
&lt;div class="w-100" >&lt;img alt="Claude running in a container, running in a terminal, running in VS Code" srcset="
/2026/06/claude-code-in-a-container/media/claude_in_vs_code_huba193ef975c5f935786e2c5af448e3c5_341647_2cc89c5c65c03c7aa4977fcdd746a4b8.webp 400w,
/2026/06/claude-code-in-a-container/media/claude_in_vs_code_huba193ef975c5f935786e2c5af448e3c5_341647_6d7e182ed60bb3fe725c3ef6e55ddb93.webp 760w,
/2026/06/claude-code-in-a-container/media/claude_in_vs_code_huba193ef975c5f935786e2c5af448e3c5_341647_1200x1200_fit_q75_h2_lanczos.webp 1200w"
src="https://nodogmablog.bryanhogan.net/2026/06/claude-code-in-a-container/media/claude_in_vs_code_huba193ef975c5f935786e2c5af448e3c5_341647_2cc89c5c65c03c7aa4977fcdd746a4b8.webp"
width="760"
height="415"
loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;figcaption>
Claude running in a container, running in a terminal, running in VS Code
&lt;/figcaption>&lt;/figure>
&lt;p>A completely isolated Claude instance that has no access to any files on your computer other than the ones you explicitly share with the container.&lt;/p></description></item></channel></rss>