Docker daemon socket: Unix by default, not TCP 2375
You are about to bind-mount /var/run/docker.sock into a tool, or you found -H tcp://0.0.0.0:2375 in a unit file. On the host, docker version can also stop with permission denied while trying to connect to the docker API at unix:///var/run/docker.sock.
By Sudipta Dhara. Published 2026-11-18. AI disclosure: drafted with AI assistance.
Leave the daemon on its Unix socket. Do not add a TCP listener. This doesn’t apply when you are hardening a Kubernetes API server, changing Docker Desktop’s Windows-only expose-2375 setting, or following a product install that requires the socket.
The Docker daemon listens on a Unix socket by default. A TCP listener is something you add. The Docker Engine security page says exposing the daemon API over HTTP without TLS is not permitted, and that configuration causes the daemon to fail early on startup. Anyone who can open the socket can ask the daemon to mount the host root. Check that 2375 is not listening, and that no container bind-mounts docker.sock. This page has no affiliate or referral links.
Who this is for: developers and devops engineers, intermediate, one Linux Docker host. You’ll need: a shell on that host, and permission to run docker or sudo.
What should you check first?
Check three facts before you mount the socket or edit a unit file.
- The Docker context host is a
unix://path. - Nothing is listening on 2375 or 2376.
- No running container has a mount source that contains
docker.sock.
On 23 October 2026 those three checks were run on a disposable Linux VM, kernel 6.8.0-142-generic. The daemon was not restarted. No listen address was added. The context host was unix:///var/run/docker.sock. The 2375 and 2376 filter printed no match. Running containers were 0, and mount sources containing docker.sock were 0.
Shareable: context host unix:///var/run/docker.sock, and no listener on 2375 or 2376. Caveat: one disposable Linux VM on 23 October 2026, kernel 6.8.0-142-generic, Docker Engine 29.8.2. A unit file on another host can still add a TCP address.
Who is this for?
This check is for a developer or a DevOps engineer on one Linux Docker host who is about to give a container the Docker socket, or who found a TCP host in a systemd unit.
Who is this not for?
This page is not for Kubernetes API-server hardening, Docker Desktop’s Windows-only “expose 2375” setting, or a product install that requires the socket. The mount warning still applies if a vendor tells you to pass docker.sock in.
What do the docs disagree on?
Three public pages, checked 23 October 2026, do not use the same sentence. Read the row, then the link. Do not treat the remote-access example as a command to run.
| Page | What it says |
|---|---|
| Engine security | HTTP without TLS is not permitted, and the daemon fails early. Only trusted users should control the daemon. A container can be given the host root directory with no extra restriction. |
| Remote access | The default listener is a Unix socket. Remote access without TLS is not recommended. The page’s own example still shows tcp://127.0.0.1:2375. |
| dockerd | The default socket is /var/run/docker.sock. Plain TCP is unencrypted and unauthenticated unless you add HTTPS. Port 2375 is the conventional plain port. Port 2376 is the conventional encrypted port. Anyone who can reach that TCP port has full Docker access. |
The security page and the dockerd page do not use the same sentence about plain HTTP. This guide does not claim every current Engine build refuses -H tcp://0.0.0.0:2375. The 23 October run did not add a TCP host, so it has no refusal line.
Moby issue 36357 asks to stop offering the API over TCP with no authentication, including on localhost, because a Unix socket already exists. Checked 23 October 2026: the issue is open, opened 20 February 2018, last updated 17 July 2026. An open issue is not a release note. Do not cite it as “Docker removed plain TCP.”
Does a read-only socket mount make the API read-only?
No. The OWASP Docker Security Cheat Sheet says not to enable a TCP daemon socket, and not to pass the socket into other containers. It also says a read-only mount does not make the Docker API read-only. A process that can connect can still send requests that change containers or the host. Filesystem mount flags do not replace API authorization.
The 23 October run did not mount the socket read-only. There is no :ro result to print. If you see this Compose shape, treat it as the pattern OWASP says to change, including when the right-hand side ends in :ro:
volumes:
- /var/run/docker.sock:/var/run/docker.sock
A socket mount is a bind mount. The choice between a named volume and a bind mount is a different page: Docker volume or bind mount.
What did the 23 October run show?
The host client was not in the docker group. docker version printed permission denied while trying to connect to the docker API at unix:///var/run/docker.sock. The same context format without sudo printed unix:///var/run/docker.sock. The same port filter without sudo printed no match. With sudo, docker version reported Engine 29.8.2, linux/arm64. uname -r printed 6.8.0-142-generic. The daemon was not restarted.
That record is from a disposable Linux VM on 23 October 2026 (2026-10-23T07:09:02Z). No machine name, provider, or address is in it. We left the group unchanged and added no TCP address. A throwaway container without the socket could not talk to the host engine. The same image with the socket mounted printed server version 29.8.2.
How do you run the same check?
Run this on the host you are about to change. Do not restart the daemon. Do not add -H tcp://.... If a command is denied, rerun that command with sudo. Do not add your user to the docker group as part of this check.
Step 1. Read the context host.
docker context inspect --format '{{.Endpoints.docker.Host}}'
You want a unix:// value. The recorded line was unix:///var/run/docker.sock.
Step 2. Look for 2375 and 2376.
ss -lnt
Keep only lines whose local address ends in :2375 or :2376. Write no match when there is no such line. Do not copy the whole ss table. The recorded filter was no match.
Step 3. Count socket mounts.
For each running container, count mount sources that contain docker.sock. Zero running containers means the count is 0. A count above 0 means a live container can open the daemon API. A :ro flag does not change that, as the OWASP page says.
Step 4. Optional mount proof, only when nothing else is running.
Skip this step on a shared host. The recorded VM had zero containers, so both commands ran with sudo and --rm. The image was not local. Pull progress is omitted. Neither container was still present afterward.
docker run --rm docker:cli docker ps
Exit code 1. The printed line was:
failed to connect to the docker API at tcp://docker:2375: lookup docker on [address omitted]:53: no such host
One numeric address was omitted in the log. The client tried tcp://docker:2375. Step 2 was still no match, so this line is not a host listener.
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock docker:cli docker version
Exit code 0. The server version inside the container was 29.8.2, the same as the host engine. --rm removed that container. It does not remove a Compose service that mounts the socket on every start.
What if docker version says permission denied?
Read the path in the error. On the recorded VM it was unix:///var/run/docker.sock. That is the default socket, not a TCP listener. That is what docker version printed before sudo.
The dockerd reference says the default socket needs root or membership of the docker group. The security page says only trusted users should control the daemon, because a container can be given the host root directory with no extra restriction. This page does not walk through a group change.
If ss shows :2375 or :2376, a TCP host was added. This page does not give the edit that turns that listener on, and it does not tell you to open a firewall port for it. Remove that tcp:// host in your own change window, then rerun step 2 until the filter is no match. The remote-access example line is tcp://127.0.0.1:2375. Do not run it.
If the mount count is not zero, name the container and decide whether it still needs the socket. Closing 2375 does not remove a bind you forgot. A read-only flag does not make the API read-only.
If a container log says tcp://docker:2375 and step 2 is no match, the client inside that image tried the hostname docker. Confirm with ss before you hunt for a host listener the filter did not show.
What are the alternatives?
Leave the daemon on the Unix socket. That is the default the remote-access page describes, and it is the host the 23 October context inspect printed.
When a remote client is required, the security page says you can use DOCKER_HOST=ssh://USER@HOST, or an SSH local forward of the socket, if you prefer SSH over TLS. This page does not generate certificates. TLS on 2376 is the other option in the dockerd reference. Plain TCP stays unauthenticated unless you add HTTPS. Do not open 2375 to watch the failure.
Rootless mode runs the daemon without host root. This page does not install it. That job is Docker or a VPS. A memory cap does not restrict who can call the daemon. That limit is Docker memory limits. Lock SSH and the firewall before a coding agent runs on the VPS. Those steps are VPS for AI coding agents. This page does not repeat them.
What are the cons?
A local Unix socket is still root-equivalent for every user in the docker group. The 23 October permission-denied line is what you see outside that group. Closing 2375 does not fix a socket mount you forgot. The recorded mount count was 0 because nothing was running, not because a Unix-only daemon cannot be mounted.
This check does not switch the daemon to rootless mode. Passing it does not prove a later Engine build will refuse tcp://0.0.0.0:2375. The recorded run never tried that bind. Step 4 also pulls docker:cli when the image is not local, and the command in the log did not pin a digest. Skip step 4 when other containers are already running.
How do you verify the host is still on the Unix socket?
After a unit-file edit, rerun steps 1 to 3. You want no 2375 or 2376 listener, a unix:// context host, and no running mount source that contains docker.sock. The recorded results were no match, unix:///var/run/docker.sock, and 0.
Does Docker listen on port 2375 by default? No. The default listener is a Unix socket. 2375 is the conventional plain-text port if you add a TCP host. The 23 October filter did not show the port.
Is closing 2375 the same as rootless mode? No. Closing a TCP port leaves a rootful daemon on the Unix socket. Rootless mode is the other guide.
What else was on the log?
Raw readings. These fields do not change the listener result. They are not repeated above as the takeaway.
- API version 1.56, minimum version 1.40
- Go version go1.26.8
- Git commit 8af9fe3
- Built Wed Sep 30 19:32:07 2026
- Experimental: false
- Client version inside the socket-mounted
docker:clicontainer: 29.9.2
What should you do next?
Run steps 1 to 3 on your host. If the mount count is not zero, remove the docker.sock bind from any container that does not still need the daemon API, then run step 3 again. Skip step 4 when other containers are running.
Talk to ProDevs for a free written diagnostic on prodevs.in/services.


