Sorry I can’t be of more help with that. While I get the concept, my mind is stuck in only seeing how this works with the Docker API.
From what I am finding, the only way to communicate with the Docker daemon is via the API, so in using the Docker CLI and spying on /var/run/docker.sock
I am seeing the various messages they are using. While the Docker API examples would seem to suggest that it is a single command, which is true in the sense that a single command does the work, there are other ping and info messages executed before the actual command is sent.
Example of capture
On terminal 1
groot@Galaxy:~$ sudo mv /var/run/docker.sock /var/run/docker.sock.original
groot@Galaxy:~$ sudo socat -t100 -v UNIX-LISTEN:/var/run/docker.sock,mode=777,reuseaddr,fork UNIX-
Using Docker CLI on terminal 2
groot@Galaxy:~$ docker pull alpine
Using default tag: latest
latest: Pulling from library/alpine
Digest: sha256:c0e9560cda118f9ec63ddefb4a173a2b2a0347082d7dff7dc14272e7841a5b5a
Status: Image is up to date for alpine:latest
docker.io/library/alpine:latest
What is captured (spy) and displayed on terminal 1
CONNECT:/var/run/docker.sock.original
> 2020/11/12 14:01:49.239890 length=82 from=0 to=81
HEAD /_ping HTTP/1.1\r
Host: docker\r
User-Agent: Docker-Client/19.03.13 (linux)\r
\r
< 2020/11/12 14:01:49.276652 length=282 from=0 to=281
HTTP/1.1 200 OK\r
Api-Version: 1.40\r
Builder-Version: 2\r
Cache-Control: no-cache, no-store, must-revalidate\r
Content-Type: text/plain; charset=utf-8\r
Date: Thu, 12 Nov 2020 19:01:49 GMT\r
Docker-Experimental: false\r
Ostype: linux\r
Pragma: no-cache\r
Server: Docker/19.03.13 (linux)\r
\r
> 2020/11/12 14:01:49.644838 length=82 from=0 to=81
HEAD /_ping HTTP/1.1\r
Host: docker\r
User-Agent: Docker-Client/19.03.13 (linux)\r
\r
< 2020/11/12 14:01:49.653505 length=282 from=0 to=281
HTTP/1.1 200 OK\r
Api-Version: 1.40\r
Builder-Version: 2\r
Cache-Control: no-cache, no-store, must-revalidate\r
Content-Type: text/plain; charset=utf-8\r
Date: Thu, 12 Nov 2020 19:01:49 GMT\r
Docker-Experimental: false\r
Ostype: linux\r
Pragma: no-cache\r
Server: Docker/19.03.13 (linux)\r
\r
> 2020/11/12 14:01:49.937226 length=82 from=0 to=81
HEAD /_ping HTTP/1.1\r
Host: docker\r
User-Agent: Docker-Client/19.03.13 (linux)\r
\r
< 2020/11/12 14:01:49.942193 length=282 from=0 to=281
HTTP/1.1 200 OK\r
Api-Version: 1.40\r
Builder-Version: 2\r
Cache-Control: no-cache, no-store, must-revalidate\r
Content-Type: text/plain; charset=utf-8\r
Date: Thu, 12 Nov 2020 19:01:49 GMT\r
Docker-Experimental: false\r
Ostype: linux\r
Pragma: no-cache\r
Server: Docker/19.03.13 (linux)\r
\r
> 2020/11/12 14:01:49.944344 length=86 from=82 to=167
GET /v1.40/info HTTP/1.1\r
Host: docker\r
User-Agent: Docker-Client/19.03.13 (linux)\r
\r
< 2020/11/12 14:01:50.140954 length=211 from=282 to=492
HTTP/1.1 200 OK\r
Api-Version: 1.40\r
Content-Type: application/json\r
Date: Thu, 12 Nov 2020 19:01:50 GMT\r
Docker-Experimental: false\r
Ostype: linux\r
Server: Docker/19.03.13 (linux)\r
Transfer-Encoding: chunked\r
\r
< 2020/11/12 14:01:50.141676 length=2377 from=493 to=2869
942\r
{"ID":"ER7F:4CFQ:NF76:MKKG:J262:DJMW:H6KE:5K5S:WZZX:KRWP:GFI7:QBKH","Containers":3,"ContainersRunning":1,"ContainersPaused":0,"ContainersStopped":2,"Images":4,"Driver":"overlay2","DriverStatus":[["Backing Filesystem","extfs"],["Supports d_type","true"],["Native Overlay Diff","true"]],"SystemStatus":null,"Plugins":{"Volume":["local"],"Network":["bridge","host","ipvlan","macvlan","null","overlay"],"Authorization":null,"Log":["awslogs","fluentd","gcplogs","gelf","journald","json-file","local","logentries","splunk","syslog"]},"MemoryLimit":true,"SwapLimit":true,"KernelMemory":true,"KernelMemoryTCP":true,"CpuCfsPeriod":true,"CpuCfsQuota":true,"CPUShares":true,"CPUSet":true,"PidsLimit":true,"IPv4Forwarding":true,"BridgeNfIptables":false,"BridgeNfIp6tables":false,"Debug":false,"NFd":51,"OomKillDisable":true,"NGoroutines":64,"SystemTime":"2020-11-12T19:01:49.986345Z","LoggingDriver":"json-file","CgroupDriver":"cgroupfs","NEventsListener":6,"KernelVersion":"4.19.128-microsoft-standard","OperatingSystem":"Docker Desktop","OSType":"linux","Architecture":"x86_64","IndexServerAddress":"https://index.docker.io/v1/","RegistryConfig":{"AllowNondistributableArtifactsCIDRs":[],"AllowNondistributableArtifactsHostnames":[],"InsecureRegistryCIDRs":["127.0.0.0/8"],"IndexConfigs":{"docker.io":{"Name":"docker.io","Mirrors":[],"Secure":true,"Official":true}},"Mirrors":[]},"NCPU":4,"MemTotal":6576685056,"GenericResources":null,"DockerRootDir":"/var/lib/docker","HttpProxy":"","HttpsProxy":"","NoProxy":"","Name":"docker-desktop","Labels":[],"ExperimentalBuild":false,"ServerVersion":"19.03.13","ClusterStore":"","ClusterAdvertise":"","Runtimes":{"runc":{"path":"runc"}},"DefaultRuntime":"runc","Swarm":{"NodeID":"","NodeAddr":"","LocalNodeState":"inactive","ControlAvailable":false,"Error":"","RemoteManagers":null},"LiveRestoreEnabled":false,"Isolation":"","InitBinary":"docker-init","ContainerdCommit":{"ID":"8fba4e9a7d01810a393d5d25a3621dc101981175","Expected":"8fba4e9a7d01810a393d5d25a3621dc101981175"},"RuncCommit":{"ID":"dc9208a3303feef5b3839f4323d9beb36df0a9dd","Expected":"dc9208a3303feef5b3839f4323d9beb36df0a9dd"},"InitCommit":{"ID":"fec3683","Expected":"fec3683"},"SecurityOptions":["name=seccomp,profile=default"],"ProductLicense":"Community Engine","Warnings":["WARNING: bridge-nf-call-iptables is disabled","WARNING: bridge-nf-call-ip6tables is disabled"]}
\r
< 2020/11/12 14:01:50.150569 length=5 from=2870 to=2874
0\r
\r
> 2020/11/12 14:01:50.743315 length=252 from=168 to=419
POST /v1.40/images/create?fromImage=alpine&tag=latest HTTP/1.1\r
Host: docker\r
User-Agent: Docker-Client/19.03.13 (linux)\r
Content-Length: 0\r
Content-Type: text/plain\r
X-Registry-Auth: eyJ1c2VybmFtZSI6ImNsb2NrcyIsInBhc3N3b3JkIjoiNXdbM2RHX2tKNyxZIn0=\r
\r
< 2020/11/12 14:01:51.383870 length=211 from=2875 to=3085
HTTP/1.1 200 OK\r
Api-Version: 1.40\r
Content-Type: application/json\r
Date: Thu, 12 Nov 2020 19:01:51 GMT\r
Docker-Experimental: false\r
Ostype: linux\r
Server: Docker/19.03.13 (linux)\r
Transfer-Encoding: chunked\r
\r
< 2020/11/12 14:01:51.394980 length=62 from=3086 to=3147
38\r
{"status":"Pulling from library/alpine","id":"latest"}\r
\r
< 2020/11/12 14:01:51.726415 length=160 from=3148 to=3307
9a\r
{"status":"Digest: sha256:c0e9560cda118f9ec63ddefb4a173a2b2a0347082d7dff7dc14272e7841a5b5a"}\r
{"status":"Status: Image is up to date for alpine:latest"}\r
\r
< 2020/11/12 14:01:51.735361 length=5 from=3308 to=3312
0\r
\r
Notice the additional HTTP request, e.g. _ping
, info
, before the actual POST
command that does the work.