How to Run Claude Code with Docker: Local Models, MCP Servers, and Secure Sandboxes

投稿日: Mar 13, 2026

Claude Code is quickly becoming a go-to AI coding assistant for developers and increasingly for non-developers who want to build with code. But to truly unlock its potential, it needs the right local infrastructure, tool access, and security boundaries.

In this blog, we’ll show you how to run Claude Code with Docker to gain full control over your models, securely connect it to real-world tools using MCP servers, and safely give it autonomy inside isolated sandboxes. Read on for practical resources to help you build a secure, private, and cost-efficient AI-powered development workflow.

Claude コード DMR フィギュア 1

Docker Model Runner で Claude Code をローカル実行

This post walks through how to configure Claude Code to use Docker Model Runner, giving you full control over your data, infrastructure, and spend. Claude Code supports custom API endpoints through the ANTHROPIC_BASE_URL environment variable. Since Docker Model Runner exposes an Anthropic-compatible API, integrating the two is simple. This allows you to run models locally while maintaining the Claude Code experience.

With your model running under your control, it’s time to connect Claude Code to tools to expand its capabilities. 

Docker MCP ToolkitでClaudeコードにMCPサーバーを追加する方法

MCP is becoming the de facto standard to connect coding agents like Claude Code to your real tools, databases, repositories, browsers, and APIs. With more than 300 pre-built,containerized MCP servers, one-click deployment in Docker Desktop, and automatic credential handling, developers can connect Claude Code to trusted environments in minutes — not hours. No dependency issues, no manual configuration, just a consistent, secure workflow across Mac, Windows, and Linux.

In this guide, you’ll learn how to:

  • Claude Codeをセットアップし、Docker MCP Toolkitに接続します。
  • Jira 統合用に Atlassian MCP サーバーを構成します。  
  • リポジトリ履歴にアクセスし、git コマンドを実行するように GitHub MCP サーバーを構成します。
  • ローカルコードベースをスキャンして読み取るようにファイルシステムMCPサーバーを設定します。
  • 15 TODO コメントを追跡された Jira チケットに変換することで、技術的負債の追跡を自動化します。
  • Claude Codeが開発環境を離れることなく、Git履歴のクエリ、課題の分類、チケットの作成を行う方法をご覧ください。

Prefer a video walkthrough? Check out our tutorial on how to add MCP servers to Claude Code with Docker MCP Toolkit.

Connecting tools unlocks powerful automation but with greater capability comes greater responsibility. If you’re going to let agents take action, you need to run them safely.

Docker Sandboxes:Claude Code やその他のコーディングエージェントを監視なしでも安全に実行

As Claude Code moves from suggestions to real-world actions like installing packages and modifying files, isolation becomes critical.

サンドボックス は、コーディングエージェント向けに特別に設計された使い捨ての分離環境を提供します。各エージェントは開発環境の独立したバージョンで動作するため、パッケージのインストール、設定の変更、ファイルの削除、Dockerコンテナの実行などを行っても、ホストマシンは手つかずのままです。

This isolation lets you run agents like Claude Code with autonomy. Since they can’t harm your computer, let them run free. Check out our announcement on more secure, easier to use, and more powerful Docker Sandboxes. 

概要 

Claude Code is powerful on its own but when used with Docker, it becomes a secure, extensible, and fully controlled AI development environment.

In this post, you learned how to:

  • Run Claude Code locally using Docker Model Runner with an Anthropic-compatible API endpoint, giving you full control over your data, infrastructure, and cost.
  • Connect Claude Code to tools using the Docker MCP Toolkit, with 300+ containerized MCP servers for services like Jira, GitHub, and local filesystems — all deployable in one click.
  • Run Claude Code safely in Docker Sandboxes, isolated environments that allow coding agents to operate autonomously without risking your host machine.

By combining local model execution, secure tool connectivity, and isolated runtime environments, Docker enables you to run AI coding agents like Claude Code with both autonomy and control, making them practical for real-world development workflows.

関連記事