Plenty of local services don’t listen on a TCP port at all. They listen on a Unix socket, a file on disk. Docker is the famous one, with /var/run/docker.sock. curl can talk HTTP over such a socket, which I find really handy for poking at an API directly.
The option is --unix-socket <path>, and it has been in curl since 7.40.0. curl connects to the socket instead of the network and sends a normal HTTP request through it. You still write a full URL. The host part doesn’t decide where curl connects (the socket does), so localhost is the usual filler:
curl -s --unix-socket /var/run/docker.sock \
http://localhost/v1.57/containers/json | jq '.[].Names'
That lists the names of the running containers, straight from the Docker Engine API, the same API the docker command uses under the hood. The v1.57 in the path is the API version from the Docker docs. Your daemon may be older, for example on an Unraid server, so run docker version and use the API version it prints. Swap the part after the version for other data: /containers/sonarr/json gives the full inspect output of one container, and /version shows what the engine runs.
I’d reach for this when I’m checking what a dashboard or monitoring tool will see through the socket, or when a script on a minimal box has curl and jq but no Docker CLI. It also works for anything else that speaks HTTP on a socket.
The caveat is a big one: access to docker.sock is effectively root on the host, because the API can start a privileged container. You need root or the docker group to use it, and that’s how it should stay. Be careful with containers that ask you to mount the socket, and when a tool only needs to read, I’d put a socket proxy in between instead of handing over the real thing.
Further reading: curl man page: –unix-socket, Docker Engine API examples