# Fix socket chmod invalid argument in Docker Desktop

> Socket chmod fails with “invalid argument” on a Docker Desktop bind mount from macOS. Why it happens, how to confirm it, and the qURL fix.

Source: https://layerv.ai/for-agents/fix-docker-desktop-socket-chmod-invalid-argument/

---

[← For agents](https://layerv.ai/for-agents/) 

# Fix socket chmod invalid argument in Docker Desktop

## Why does chmod on a Unix socket fail with “invalid argument” in Docker Desktop on a Mac?

```
Error: restrict share daemon socket: chmod /home/node/.local/state/qurl/connector-v2/daemon.sock: invalid argument
```

Docker Desktop for macOS shares a Mac folder into a Linux container through a file system that cannot set the mode of a Unix socket, so socket chmod fails with EINVAL, “invalid argument”, while chmod on a regular file works. Keep the socket on a path inside the container. For qURL™, set QURL\_CONNECTOR\_RUNTIME\_DIR=/tmp/qurl-run, or keep qurl’s state on a Docker volume, and publish again: it reuses the same CRID.

**Reproduced with qURL CLI 3.6.1 and 3.7.1.** Reproduced on Docker Desktop 4.55 for macOS with Linux arm64 containers. Each fix was run until the app was serving. Other Docker Desktop releases and file sharing backends were not tested. Verified November 5, 2026.

## Why socket chmod fails on a bind mount

In Docker Desktop 4.55 for macOS, a folder bind-mounted from the Mac shows up inside the container with the file system type fakeowner. On it, a program can create a Unix socket and can change the mode of a regular file, but changing the mode of the socket fails with EINVAL. The same calls on the container’s own /tmp succeed.

It is not a permissions problem: the runs that showed this were made as the container user that owned the folder. Any program that restricts its socket after creating it fails the same way. In Python, os.chmod on the socket raises “\[Errno 22\] Invalid argument”.

The qURL CLI keeps the control socket of its share daemon in its state directory, which is $HOME/.local/state/qurl/connector-v2 by default. When the container’s home directory is a folder from the Mac, qurl publish creates the socket there, restricts it to mode 0600, and stops at this error. Adding --foreground does not avoid it.

## What the failed publish left behind

qurl publish creates the resource before it starts the daemon. When the daemon fails, publish turns sharing off and keeps the resource, so qurl list --status active shows the app with desired\_state off. It counts toward the device’s limit.

Nothing is lost. Once the socket is somewhere it can be restricted, the same publish with the same state finds that resource and serves it under the same CRID. To remove it instead, run qurl delete <CRID> --yes from the same state, before the state is thrown away: nothing else can delete it.

## Fix it

1. ### Check that qurl’s state is on a folder from the Mac  
Inside the container, ask which file system holds qurl’s state. fakeowner means a folder shared from the Mac; the container’s own /tmp reads overlay.  
```  
findmnt -no FSTYPE -T "$HOME/.local/state"
```  
fakeowner
2. ### Move only the socket into the container  
QURL\_CONNECTOR\_RUNTIME\_DIR moves the daemon’s socket and leaves the device identity where it is, so the identity on the Mac folder survives the container. qurl creates the directory with mode 0700; a directory that already exists must have that mode. Set it for every qurl command: qurl 3.7.1 records the directory for commands run without it, and 3.6.1 does not.  
```  
# when you start the container:
docker run -e QURL_CONNECTOR_RUNTIME_DIR=/tmp/qurl-run \
  -v ~/qurl-home:/home/node <image>
# or inside the container, before anything else:
export QURL_CONNECTOR_RUNTIME_DIR=/tmp/qurl-run
```
3. ### Or keep all of qurl’s state on a Docker volume  
A named volume is a Linux file system, so the socket and the identity both live there, and your app’s files can stay on the bind mount. A new volume belongs to root: make it the container user’s and private before the first qurl command. Keep the volume until qurl delete has run, because it holds the only identity that can delete the resource.  
```  
docker volume create qurl-state
docker run --rm --user root -v qurl-state:/qurl-state <image> \
  sh -c "chown 1000:1000 /qurl-state && chmod 700 /qurl-state"
docker run -v qurl-state:/qurl-state \
  -e QURL_CONNECTOR_STATE_DIR=/qurl-state <image>
```
4. ### Publish again  
Run the same publish, as a background job that keeps running. With the socket moved, it prints “This target was already published; showing the existing resource.” and reaches serving, with found\_existing true and the CRID of the failed attempt. With a new volume it is a new identity, so the CRID is new.  
```  
nohup qurl publish http://127.0.0.1:3000 --foreground -o json \
  > publish.json 2> publish.log < /dev/null &
```

## Frequently Asked Questions

Does --foreground avoid the socket error? 

No. A foreground publish runs the daemon inside its own process, but the daemon still creates and restricts its socket in the state directory. Move the socket with QURL\_CONNECTOR\_RUNTIME\_DIR, or the whole state with QURL\_CONNECTOR\_STATE\_DIR.

Will the app get a new CRID after the fix? 

Not if the state stays where it was. Moving only the socket keeps the identity, and publishing the same address again returns the resource the failed attempt created, with the same CRID. A new state directory or volume is a new device identity, and its first publish makes a new resource with a new CRID.

Is it safe to keep the socket in /tmp inside the container? 

Yes. qurl creates the runtime directory with mode 0700 and the socket with mode 0600, so other users in the container cannot connect to it. An existing directory is used only if it already has mode 0700\. The socket controls the daemon; the device credential stays in the state directory.

Does this affect programs other than qurl? 

Yes, any program that changes the mode of a Unix socket it creates in a folder bind-mounted from the Mac. The same EINVAL came back from Python’s os.chmod. Regular files are not affected.

## Related Resources

[qURL CLI errors and exit codes →](https://layerv.ai/for-agents/qurl-cli-errors/) [Guide: Share an app from a container or CI →](https://layerv.ai/guides/share-from-a-container-or-ci/) [The qURL skill →](https://layerv.ai/skills/qurl/SKILL.md) [qURL CLI →](https://layerv.ai/cli/)

## Give your agent the qURL skill

One file teaches a coding agent to publish an app privately, let people and other agents in, and recover when the CLI stops it. No account, no API key.

[Read the skill →](https://layerv.ai/skills/qurl/SKILL.md)



---

*This markdown version is auto-generated from [https://layerv.ai/for-agents/fix-docker-desktop-socket-chmod-invalid-argument/](https://layerv.ai/for-agents/fix-docker-desktop-socket-chmod-invalid-argument/) for AI agents. Curated agent resources: [llms.txt](https://layerv.ai/llms.txt). For the full interactive experience, visit the HTML version.*

