Cursor agent is unable to run terminal commands that connect to Docker containers

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Whenever Cursor agent tries to run rails tests, it fails. It will always report back and say “no local MySQL”. This appears to be some limitation of how the agent runs commands.

My local MySQL server is a docker container. If I take the exact same command that Agent tried to run and paste it into my normal Cursor terminal, it works every time.

I’ve tried changing my Agent terminal settings:

  • auto-run in sandbox and whitelist the commands (doesn’t work)
  • run everything unsandboxed, still doesn’t work

Note: This used to work intermittently, but stopped working perhaps 2-3 weeks ago. Before, Cursor would try to run it in the sandbox and it would fail, then it would retry outside the sandbox and that would usually work. Now, nothing does.

Steps to Reproduce

Have a Rails app that uses a Dockerized MySQL server
Tell Agent to run tests
Watch it be unable to connect

Expected Behavior

Agent should be able to run operations that involve connecting to Docker containers on localhost

Screenshots / Screen Recordings

Operating System

MacOS

Version Information

Version: 2.6.20
VSCode Version: 1.105.1
Commit: b29eb4ee5f9f6d1cb2afbc09070198d3ea6ad760
Date: 2026-03-17T01:50:02.404Z
Build Type: Stable
Release Track: Default
Electron: 39.8.1
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
OS: Darwin arm64 25.3.0

For AI issues: which model did you use?

Affects all models

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, thanks for the report. This is a known issue. On macOS, the sandbox blocks Unix domain sockets, which Docker uses for connections, even if the paths are added to additionalReadwritePaths. More details in a similar thread: MacOS sandbox blocking Docker socket connection

As a workaround, create or edit ~/.cursor/sandbox.json and add:

{
  "networkPolicy": {
    "default": "allow"
  }
}

This will allow network connections inside the sandbox, including Unix sockets for Docker.

Also, since you mentioned it doesn’t work even without the sandbox, check macOS System Settings > Privacy & Security > Local Network and make sure Cursor is allowed there. Starting with macOS Sequoia, Apple requires explicit permission to connect to localhost.

Let me know if the workaround helped.

A post was merged into an existing topic: MacOS sandbox blocking Docker socket connection