惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

B
Blog
量子位
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Last Week in AI
Last Week in AI
酷 壳 – CoolShell
酷 壳 – CoolShell
人人都是产品经理
人人都是产品经理
Jina AI
Jina AI
雷峰网
雷峰网
博客园_首页
WordPress大学
WordPress大学
博客园 - 司徒正美
爱范儿
爱范儿
博客园 - 聂微东
IT之家
IT之家
美团技术团队
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
有赞技术团队
有赞技术团队
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
Tailwind CSS Blog
博客园 - Franky
V
V2EX
GbyAI
GbyAI
阮一峰的网络日志
阮一峰的网络日志

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Your AI Agent Can Delete Every Container on Your Machine
PolicyLayer · 2026-06-16 · via DEV Community

PolicyLayer

Your AI coding assistant just wiped your local Docker environment. You asked it to "clean up that test container," and it decided to be thorough — removed every container, deleted the images they were built from, and destroyed the volumes holding your database state. Your PostgreSQL data, your Redis cache, your Elasticsearch index. Gone. No confirmation prompt, no undo.

It was trying to help. The Docker MCP server gave it the tools to list, create, start, stop, and — critically — remove every Docker resource on your machine. The agent saw old containers, stale images, and orphaned volumes. It cleaned them all. As we explored in What Happens When Your AI Agent Goes Rogue, these aren't edge cases. They're the predictable consequence of giving agents destructive capabilities without constraints.

What the Docker MCP server exposes

The ckreiling/mcp-server-docker MCP server exposes 19 tools. The read operations are harmless — list_containers, list_images, list_volumes, fetch_container_logs. Fine. Let agents inspect your environment all day.

The problem is the other half:

  • remove_container — deletes a container and its state
  • remove_image — deletes a Docker image from the local registry
  • remove_network — destroys a Docker network
  • remove_volume — deletes a volume, including all data inside it

Then there are the creation and execution tools — create_container, run_container, build_image, pull_image. Not destructive individually, but a runaway loop pulling hundreds of images or spawning containers will exhaust your disk and CPU in minutes.

MCP provides no built-in mechanism to restrict any of this.

Block removals, rate limit creation

Intercept sits between your agent and the Docker MCP server. Every tools/call is evaluated against a YAML policy before it reaches Docker. Violating calls are blocked and the agent receives a clear denial message — no silent failures.

First, block all destructive operations outright:

version: "1"
description: "Policy for ckreiling/mcp-server-docker"
default: "allow"
tools:
    remove_container:
        rules:
            - name: "block container removal"
              action: deny
              on_deny: "Removing containers is not permitted. Stop the container instead."
    remove_image:
        rules:
            - name: "block image removal"
              action: deny
              on_deny: "Removing images is not permitted."
    remove_network:
        rules:
            - name: "block network removal"
              action: deny
              on_deny: "Removing networks is not permitted."
    remove_volume:
        rules:
            - name: "block volume removal"
              action: deny
              on_deny: "Removing volumes is not permitted. Volume data could be lost."

Four action: deny rules. Unconditional. The agent can still stop containers — it just cannot delete anything. When it tries, it gets the on_deny message as the tool response, telling it what to do instead.

Next, rate limit the creation tools to prevent runaway loops:

    create_container:
        rules:
            - name: "rate limit container creation"
              rate_limit: "10/hour"
              on_deny: "Container creation rate limit exceeded (10/hour). Wait before creating more containers."
    run_container:
        rules:
            - name: "rate limit container run"
              rate_limit: "10/hour"
              on_deny: "Container run rate limit exceeded (10/hour). Wait before running more containers."
    build_image:
        rules:
            - name: "rate limit image build"
              rate_limit: "10/hour"
              on_deny: "Image build rate limit exceeded (10/hour). Wait before building more images."
    pull_image:
        rules:
            - name: "rate limit image pull"
              rate_limit: "10/hour"
              on_deny: "Image pull rate limit exceeded (10/hour). Wait before pulling more images."

Ten per hour on each creation tool. Enough for legitimate development workflows. Not enough to fill your disk.

A global rate limit catches everything else:

    "*":
        rules:
            - name: "global rate limit"
              rate_limit: "60/minute"
              on_deny: "Global rate limit exceeded (60 calls/minute). Slow down."

The default: "allow" posture lets read tools pass through unrestricted. If you want tighter control, switch to default: "deny" and explicitly allowlist each tool.

Getting started

Install Intercept and point it at the Docker MCP server:

npm install -g @policylayer/intercept

Then run it with the Docker policy:

intercept -c docker.yaml -- npx -y @ckreiling/mcp-server-docker

Every tool call now passes through the policy engine. Container removal gets blocked. Image pull number 11 in an hour gets blocked. Your volumes survive the agent's enthusiasm for tidying up.

Full Docker policy →