PolarSPARC

Short Primer on Docker Socket


Bhaskar S 12/27/2025


Overview

Ever wondered how the docker cli command (docker) communicates with the docker daemon process (dockerd) ???

Have you ever noticed the presence of the file /var/run/docker.sock ???

Why these two questions all of a sudden AND are they related by any chance ???

In short, the answer is an YES !!!

When the docker deamon process (dockerd) starts up, it creates a Unix Domain Socket and binds it to the specific file /var/run/docker.sock, which then serves as the primary communication endpoint for the docker cli command (docker). It is the main entry point for both the docker CLI and docker API. In other words, when one issues any docker command, it uses the Unix Domain Socket bound to the file /var/run/docker.sock to execute the command on the docker daemon (dockerd).

Note that a Unix Domain Socket is a low latency and highly performant inter-process communication method, which enables client and server processes running on the SAME host to exchange data with each other (bidirectional) with minimal overhead.


Hands-on Docker Socket

The hands-on demonstration will be on a Ubuntu 24.04 LTS based Linux desktop. Ensure that Docker is installed and setup on the desktop (see INSTRUCTIONS).

To ensure the pre-requisite certs and utilities are installed, execute the following command in a terminal window:


$ sudo apt-get install -y ca-certificates curl jq


The following could be the typical output:


Output.1

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
ca-certificates is already the newest version (20240203).
curl is already the newest version (8.5.0-2ubuntu10.6).
jq is already the newest version (1.7.1-3ubuntu0.24.04.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

To check the version of Docker on the system, execute the following command in a terminal window:


$ curl -s --unix-socket /var/run/docker.sock http://localhost/version | jq


The following should be the typical output:


Output.2

{
  "Platform": {
    "Name": ""
  },
  "Components": [
    {
      "Name": "Engine",
      "Version": "28.2.2",
      "Details": {
        "ApiVersion": "1.50",
        "Arch": "amd64",
        "BuildTime": "2025-09-10T14:16:39.000000000+00:00",
        "Experimental": "false",
        "GitCommit": "28.2.2-0ubuntu1~24.04.1",
        "GoVersion": "go1.23.1",
        "KernelVersion": "6.8.0-90-generic",
        "MinAPIVersion": "1.24",
        "Os": "linux"
      }
    },
    {
      "Name": "containerd",
      "Version": "1.7.28",
      "Details": {
        "GitCommit": ""
      }
    },
    {
      "Name": "runc",
      "Version": "1.3.3-0ubuntu1~24.04.3",
      "Details": {
        "GitCommit": ""
      }
    },
    {
      "Name": "docker-init",
      "Version": "0.19.0",
      "Details": {
        "GitCommit": ""
      }
    }
  ],
  "Version": "28.2.2",
  "ApiVersion": "1.50",
  "MinAPIVersion": "1.24",
  "GitCommit": "28.2.2-0ubuntu1~24.04.1",
  "GoVersion": "go1.23.1",
  "Os": "linux",
  "Arch": "amd64",
  "KernelVersion": "6.8.0-90-generic",
  "BuildTime": "2025-09-10T14:16:39.000000000+00:00"
}

To get a detailed system-wide information about docker, execute the following command in a terminal window:


$ curl -s --unix-socket /var/run/docker.sock http://localhost/info | jq


The following should be the typical output:


Output.3

{
  "ID": "191f8707-fd37-4da1-906c-c6bb93052ce3",
  "Containers": 0,
  "ContainersRunning": 0,
  "ContainersPaused": 0,
  "ContainersStopped": 0,
  "Images": 9,
  "Driver": "overlay2",
  "DriverStatus": [
    [
      "Backing Filesystem",
      "extfs"
    ],
    [
      "Supports d_type",
      "true"
    ],
    [
      "Using metacopy",
      "false"
    ],
    [
      "Native Overlay Diff",
      "true"
    ],
    [
      "userxattr",
      "false"
    ]
  ],
  "Plugins": {
    "Volume": [
      "local"
    ],
    "Network": [
      "bridge",
      "host",
      "ipvlan",
      "macvlan",
      "null",
      "overlay"
    ],
    "Authorization": null,
    "Log": [
      "awslogs",
      "fluentd",
      "gcplogs",
      "gelf",
      "journald",
      "json-file",
      "local",
      "splunk",
      "syslog"
    ]
  },
  "MemoryLimit": true,
  "SwapLimit": true,
  "CpuCfsPeriod": true,
  "CpuCfsQuota": true,
  "CPUShares": true,
  "CPUSet": true,
  "PidsLimit": true,
  "IPv4Forwarding": true,
  "Debug": false,
  "NFd": 33,
  "OomKillDisable": false,
  "NGoroutines": 45,
  "SystemTime": "2025-12-27T14:39:15.627645405-05:00",
  "LoggingDriver": "json-file",
  "CgroupDriver": "systemd",
  "CgroupVersion": "2",
  "NEventsListener": 0,
  "KernelVersion": "6.8.0-90-generic",
  "OperatingSystem": "Linux Mint 22.2",
  "OSVersion": "22.2",
  "OSType": "linux",
  "Architecture": "x86_64",
  "IndexServerAddress": "https://index.docker.io/v1/",
  "RegistryConfig": {
    "IndexConfigs": {
      "docker.io": {
        "Mirrors": [],
        "Name": "docker.io",
        "Official": true,
        "Secure": true
      }
    },
    "InsecureRegistryCIDRs": [
      "::1/128",
      "127.0.0.0/8"
    ],
    "Mirrors": null
  },
  "NCPU": 16,
  "MemTotal": 67341561856,
  "GenericResources": null,
  "DockerRootDir": "/var/lib/docker",
  "HttpProxy": "",
  "HttpsProxy": "",
  "NoProxy": "",
  "Name": "kailash",
  "Labels": [],
  "ExperimentalBuild": false,
  "ServerVersion": "28.2.2",
  "Runtimes": {
    "io.containerd.runc.v2": {
      "path": "runc",
      "status": {
        "org.opencontainers.runtime-spec.features": "{\"ociVersionMin\":\"1.0.0\",\"ociVersionMax\":\"1.2.1\",\"hooks\":[\"prestart\",\"createRuntime\",\"createContainer\",\"startContainer\",\"poststart\",\"poststop\"],\"mountOptions\":[\"async\",\"atime\",\"bind\",\"defaults\",\"dev\",\"diratime\",\"dirsync\",\"exec\",\"iversion\",\"lazytime\",\"loud\",\"mand\",\"noatime\",\"nodev\",\"nodiratime\",\"noexec\",\"noiversion\",\"nolazytime\",\"nomand\",\"norelatime\",\"nostrictatime\",\"nosuid\",\"nosymfollow\",\"private\",\"ratime\",\"rbind\",\"rdev\",\"rdiratime\",\"relatime\",\"remount\",\"rexec\",\"rnoatime\",\"rnodev\",\"rnodiratime\",\"rnoexec\",\"rnorelatime\",\"rnostrictatime\",\"rnosuid\",\"rnosymfollow\",\"ro\",\"rprivate\",\"rrelatime\",\"rro\",\"rrw\",\"rshared\",\"rslave\",\"rstrictatime\",\"rsuid\",\"rsymfollow\",\"runbindable\",\"rw\",\"shared\",\"silent\",\"slave\",\"strictatime\",\"suid\",\"symfollow\",\"sync\",\"tmpcopyup\",\"unbindable\"],\"linux\":{\"namespaces\":[\"cgroup\",\"ipc\",\"mount\",\"network\",\"pid\",\"time\",\"user\",\"uts\"],\"capabilities\":[\"CAP_CHOWN\",\"CAP_DAC_OVERRIDE\",\"CAP_DAC_READ_SEARCH\",\"CAP_FOWNER\",\"CAP_FSETID\",\"CAP_KILL\",\"CAP_SETGID\",\"CAP_SETUID\",\"CAP_SETPCAP\",\"CAP_LINUX_IMMUTABLE\",\"CAP_NET_BIND_SERVICE\",\"CAP_NET_BROADCAST\",\"CAP_NET_ADMIN\",\"CAP_NET_RAW\",\"CAP_IPC_LOCK\",\"CAP_IPC_OWNER\",\"CAP_SYS_MODULE\",\"CAP_SYS_RAWIO\",\"CAP_SYS_CHROOT\",\"CAP_SYS_PTRACE\",\"CAP_SYS_PACCT\",\"CAP_SYS_ADMIN\",\"CAP_SYS_BOOT\",\"CAP_SYS_NICE\",\"CAP_SYS_RESOURCE\",\"CAP_SYS_TIME\",\"CAP_SYS_TTY_CONFIG\",\"CAP_MKNOD\",\"CAP_LEASE\",\"CAP_AUDIT_WRITE\",\"CAP_AUDIT_CONTROL\",\"CAP_SETFCAP\",\"CAP_MAC_OVERRIDE\",\"CAP_MAC_ADMIN\",\"CAP_SYSLOG\",\"CAP_WAKE_ALARM\",\"CAP_BLOCK_SUSPEND\",\"CAP_AUDIT_READ\",\"CAP_PERFMON\",\"CAP_BPF\",\"CAP_CHECKPOINT_RESTORE\"],\"cgroup\":{\"v1\":true,\"v2\":true,\"systemd\":true,\"systemdUser\":true,\"rdma\":true},\"seccomp\":{\"enabled\":true,\"actions\":[\"SCMP_ACT_ALLOW\",\"SCMP_ACT_ERRNO\",\"SCMP_ACT_KILL\",\"SCMP_ACT_KILL_PROCESS\",\"SCMP_ACT_KILL_THREAD\",\"SCMP_ACT_LOG\",\"SCMP_ACT_NOTIFY\",\"SCMP_ACT_TRACE\",\"SCMP_ACT_TRAP\"],\"operators\":[\"SCMP_CMP_EQ\",\"SCMP_CMP_GE\",\"SCMP_CMP_GT\",\"SCMP_CMP_LE\",\"SCMP_CMP_LT\",\"SCMP_CMP_MASKED_EQ\",\"SCMP_CMP_NE\"],\"archs\":[\"SCMP_ARCH_AARCH64\",\"SCMP_ARCH_ARM\",\"SCMP_ARCH_MIPS\",\"SCMP_ARCH_MIPS64\",\"SCMP_ARCH_MIPS64N32\",\"SCMP_ARCH_MIPSEL\",\"SCMP_ARCH_MIPSEL64\",\"SCMP_ARCH_MIPSEL64N32\",\"SCMP_ARCH_PPC\",\"SCMP_ARCH_PPC64\",\"SCMP_ARCH_PPC64LE\",\"SCMP_ARCH_RISCV64\",\"SCMP_ARCH_S390\",\"SCMP_ARCH_S390X\",\"SCMP_ARCH_X32\",\"SCMP_ARCH_X86\",\"SCMP_ARCH_X86_64\"],\"knownFlags\":[\"SECCOMP_FILTER_FLAG_TSYNC\",\"SECCOMP_FILTER_FLAG_SPEC_ALLOW\",\"SECCOMP_FILTER_FLAG_LOG\"],\"supportedFlags\":[\"SECCOMP_FILTER_FLAG_TSYNC\",\"SECCOMP_FILTER_FLAG_SPEC_ALLOW\",\"SECCOMP_FILTER_FLAG_LOG\"]},\"apparmor\":{\"enabled\":true},\"selinux\":{\"enabled\":true},\"intelRdt\":{\"enabled\":true},\"mountExtensions\":{\"idmap\":{\"enabled\":true}}},\"annotations\":{\"io.github.seccomp.libseccomp.version\":\"2.5.5\",\"org.opencontainers.runc.checkpoint.enabled\":\"true\",\"org.opencontainers.runc.commit\":\"\",\"org.opencontainers.runc.version\":\"1.3.3-0ubuntu1~24.04.3\"},\"potentiallyUnsafeConfigAnnotations\":[\"bundle\",\"org.systemd.property.\",\"org.criu.config\"]}"
      }
    },
    "runc": {
      "path": "runc",
      "status": {
        "org.opencontainers.runtime-spec.features": "{\"ociVersionMin\":\"1.0.0\",\"ociVersionMax\":\"1.2.1\",\"hooks\":[\"prestart\",\"createRuntime\",\"createContainer\",\"startContainer\",\"poststart\",\"poststop\"],\"mountOptions\":[\"async\",\"atime\",\"bind\",\"defaults\",\"dev\",\"diratime\",\"dirsync\",\"exec\",\"iversion\",\"lazytime\",\"loud\",\"mand\",\"noatime\",\"nodev\",\"nodiratime\",\"noexec\",\"noiversion\",\"nolazytime\",\"nomand\",\"norelatime\",\"nostrictatime\",\"nosuid\",\"nosymfollow\",\"private\",\"ratime\",\"rbind\",\"rdev\",\"rdiratime\",\"relatime\",\"remount\",\"rexec\",\"rnoatime\",\"rnodev\",\"rnodiratime\",\"rnoexec\",\"rnorelatime\",\"rnostrictatime\",\"rnosuid\",\"rnosymfollow\",\"ro\",\"rprivate\",\"rrelatime\",\"rro\",\"rrw\",\"rshared\",\"rslave\",\"rstrictatime\",\"rsuid\",\"rsymfollow\",\"runbindable\",\"rw\",\"shared\",\"silent\",\"slave\",\"strictatime\",\"suid\",\"symfollow\",\"sync\",\"tmpcopyup\",\"unbindable\"],\"linux\":{\"namespaces\":[\"cgroup\",\"ipc\",\"mount\",\"network\",\"pid\",\"time\",\"user\",\"uts\"],\"capabilities\":[\"CAP_CHOWN\",\"CAP_DAC_OVERRIDE\",\"CAP_DAC_READ_SEARCH\",\"CAP_FOWNER\",\"CAP_FSETID\",\"CAP_KILL\",\"CAP_SETGID\",\"CAP_SETUID\",\"CAP_SETPCAP\",\"CAP_LINUX_IMMUTABLE\",\"CAP_NET_BIND_SERVICE\",\"CAP_NET_BROADCAST\",\"CAP_NET_ADMIN\",\"CAP_NET_RAW\",\"CAP_IPC_LOCK\",\"CAP_IPC_OWNER\",\"CAP_SYS_MODULE\",\"CAP_SYS_RAWIO\",\"CAP_SYS_CHROOT\",\"CAP_SYS_PTRACE\",\"CAP_SYS_PACCT\",\"CAP_SYS_ADMIN\",\"CAP_SYS_BOOT\",\"CAP_SYS_NICE\",\"CAP_SYS_RESOURCE\",\"CAP_SYS_TIME\",\"CAP_SYS_TTY_CONFIG\",\"CAP_MKNOD\",\"CAP_LEASE\",\"CAP_AUDIT_WRITE\",\"CAP_AUDIT_CONTROL\",\"CAP_SETFCAP\",\"CAP_MAC_OVERRIDE\",\"CAP_MAC_ADMIN\",\"CAP_SYSLOG\",\"CAP_WAKE_ALARM\",\"CAP_BLOCK_SUSPEND\",\"CAP_AUDIT_READ\",\"CAP_PERFMON\",\"CAP_BPF\",\"CAP_CHECKPOINT_RESTORE\"],\"cgroup\":{\"v1\":true,\"v2\":true,\"systemd\":true,\"systemdUser\":true,\"rdma\":true},\"seccomp\":{\"enabled\":true,\"actions\":[\"SCMP_ACT_ALLOW\",\"SCMP_ACT_ERRNO\",\"SCMP_ACT_KILL\",\"SCMP_ACT_KILL_PROCESS\",\"SCMP_ACT_KILL_THREAD\",\"SCMP_ACT_LOG\",\"SCMP_ACT_NOTIFY\",\"SCMP_ACT_TRACE\",\"SCMP_ACT_TRAP\"],\"operators\":[\"SCMP_CMP_EQ\",\"SCMP_CMP_GE\",\"SCMP_CMP_GT\",\"SCMP_CMP_LE\",\"SCMP_CMP_LT\",\"SCMP_CMP_MASKED_EQ\",\"SCMP_CMP_NE\"],\"archs\":[\"SCMP_ARCH_AARCH64\",\"SCMP_ARCH_ARM\",\"SCMP_ARCH_MIPS\",\"SCMP_ARCH_MIPS64\",\"SCMP_ARCH_MIPS64N32\",\"SCMP_ARCH_MIPSEL\",\"SCMP_ARCH_MIPSEL64\",\"SCMP_ARCH_MIPSEL64N32\",\"SCMP_ARCH_PPC\",\"SCMP_ARCH_PPC64\",\"SCMP_ARCH_PPC64LE\",\"SCMP_ARCH_RISCV64\",\"SCMP_ARCH_S390\",\"SCMP_ARCH_S390X\",\"SCMP_ARCH_X32\",\"SCMP_ARCH_X86\",\"SCMP_ARCH_X86_64\"],\"knownFlags\":[\"SECCOMP_FILTER_FLAG_TSYNC\",\"SECCOMP_FILTER_FLAG_SPEC_ALLOW\",\"SECCOMP_FILTER_FLAG_LOG\"],\"supportedFlags\":[\"SECCOMP_FILTER_FLAG_TSYNC\",\"SECCOMP_FILTER_FLAG_SPEC_ALLOW\",\"SECCOMP_FILTER_FLAG_LOG\"]},\"apparmor\":{\"enabled\":true},\"selinux\":{\"enabled\":true},\"intelRdt\":{\"enabled\":true},\"mountExtensions\":{\"idmap\":{\"enabled\":true}}},\"annotations\":{\"io.github.seccomp.libseccomp.version\":\"2.5.5\",\"org.opencontainers.runc.checkpoint.enabled\":\"true\",\"org.opencontainers.runc.commit\":\"\",\"org.opencontainers.runc.version\":\"1.3.3-0ubuntu1~24.04.3\"},\"potentiallyUnsafeConfigAnnotations\":[\"bundle\",\"org.systemd.property.\",\"org.criu.config\"]}"
      }
    }
  },
  "DefaultRuntime": "runc",
  "Swarm": {
    "NodeID": "",
    "NodeAddr": "",
    "LocalNodeState": "inactive",
    "ControlAvailable": false,
    "Error": "",
    "RemoteManagers": null
  },
  "LiveRestoreEnabled": false,
  "Isolation": "",
  "InitBinary": "docker-init",
  "ContainerdCommit": {
    "ID": ""
  },
  "RuncCommit": {
    "ID": ""
  },
  "InitCommit": {
    "ID": ""
  },
  "SecurityOptions": [
    "name=apparmor",
    "name=seccomp,profile=builtin",
    "name=cgroupns"
  ],
  "FirewallBackend": {
    "Driver": "iptables"
  },
  "CDISpecDirs": [
    "/etc/cdi",
    "/var/run/cdi"
  ],
  "Containerd": {
    "Address": "/run/containerd/containerd.sock",
    "Namespaces": {
      "Containers": "moby",
      "Plugins": "plugins.moby"
    }
  },
  "Warnings": null
}

To list all the docker image(s) on the Linux host, execute the following command in the terminal window:


$ curl -s --unix-socket /var/run/docker.sock http://localhost/images/json | jq


The following could be a typical output:


Output.4

[
  {
    "Containers": -1,
    "Created": 1766553165,
    "Id": "sha256:60c7917932fe9be867e9bc2a8645e9ca73d10b83c0b67faf11135679bf5e2a89",
    "Labels": {
      "maintainer": "NVIDIA CORPORATION ",
      "org.opencontainers.image.ref.name": "ubuntu",
      "org.opencontainers.image.version": "22.04"
    },
    "ParentId": "",
    "RepoDigests": [
      "ghcr.io/ggml-org/llama.cpp@sha256:614d1b70a777b4914f5a928fdde72d6602c3b5bde6114c446dbe1c4d4e51d2d1"
    ],
    "RepoTags": [
      "ghcr.io/ggml-org/llama.cpp:full-cuda-b7524"
    ],
    "SharedSize": -1,
    "Size": 5133088849
  },
  {
    "Containers": -1,
    "Created": 1766093128,
    "Id": "sha256:0cab1dbf8bb2a3526530dbb858f8588c9e30e745828af8c8e27575296f8a5261",
    "Labels": {
      "org.opencontainers.image.ref.name": "ubuntu",
      "org.opencontainers.image.version": "24.04"
    },
    "ParentId": "",
    "RepoDigests": [
      "ollama/ollama@sha256:2c9595c555fd70a28363489ac03bd5bf9e7c5bdf2890373c3a830ffd7252ce6d"
    ],
    "RepoTags": [
      "ollama/ollama:0.13.5"
    ],
    "SharedSize": -1,
    "Size": 3958331219
  },
  {
    "Containers": -1,
    "Created": 1751317461,
    "Id": "sha256:64a37fe5b94a73d8a37f4f30bc5f05ee59af2c92a8dab0f3d375cf17e6f4d6df",
    "Labels": {
      "com.docker.desktop.service": "model-runner",
      "org.opencontainers.image.ref.name": "ubuntu",
      "org.opencontainers.image.version": "24.04"
    },
    "ParentId": "",
    "RepoDigests": [
      "docker/model-runner@sha256:4c6a900efd9c035bb2bda50e34b8682b6dc92b23b218ad5b0fa8f928aa0d5306"
    ],
    "RepoTags": [
      "docker/model-runner:latest"
    ],
    "SharedSize": -1,
    "Size": 109443989
  },
  {
    "Containers": -1,
    "Created": 1746481115,
    "Id": "sha256:4a6884f683ff7849d4e925d2067cbba38dbc899ebe598791628e45b55480b7de",
    "Labels": {
      "maintainer": "NVIDIA CORPORATION ",
      "org.opencontainers.image.ref.name": "ubuntu",
      "org.opencontainers.image.version": "24.04"
    },
    "ParentId": "",
    "RepoDigests": [
      "nvidia/cuda@sha256:48e21b10467354655f5073c05eebdeaac9818c6b40d70f334f7ad2df000463d8"
    ],
    "RepoTags": [
      "nvidia/cuda:12.9.0-base-ubuntu24.04"
    ],
    "SharedSize": -1,
    "Size": 335388048
  }
]

Note the Output.4 above could be different for others based on the docker image(s) they have on their system.

To fetch the docker image ID for the ollama image, execute the following command in the terminal window:


$ docker images | grep ollama


The following would be a typical output:


Output.5

ollama/ollama       0.13.5      0cab1dbf8bb2   8 days ago     3.96GB

From the Output.5 above, the docker image ID for the ollama image is 0cab1dbf8bb2.

To inspect the docker image with ID 0cab1dbf8bb2, execute the following command in the terminal window:


$ curl -s --unix-socket /var/run/docker.sock http://foo/images/0cab1dbf8bb2/json | jq


The following would be a typical output:


Output.6

{
  "Id": "sha256:0cab1dbf8bb2a3526530dbb858f8588c9e30e745828af8c8e27575296f8a5261",
  "RepoTags": [
    "ollama/ollama:0.13.5"
  ],
  "RepoDigests": [
    "ollama/ollama@sha256:2c9595c555fd70a28363489ac03bd5bf9e7c5bdf2890373c3a830ffd7252ce6d"
  ],
  "Parent": "",
  "Comment": "buildkit.dockerfile.v0",
  "Created": "2025-12-18T21:25:28.541677258Z",
  "DockerVersion": "",
  "Author": "",
  "Config": {
    "ExposedPorts": {
      "11434/tcp": {}
    },
    "Env": [
      "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
      "LD_LIBRARY_PATH=/usr/local/nvidia/lib:/usr/local/nvidia/lib64",
      "NVIDIA_DRIVER_CAPABILITIES=compute,utility",
      "NVIDIA_VISIBLE_DEVICES=all",
      "OLLAMA_HOST=0.0.0.0:11434"
    ],
    "Entrypoint": [
      "/bin/ollama"
    ],
    "Cmd": [
      "serve"
    ],
    "Labels": {
      "org.opencontainers.image.ref.name": "ubuntu",
      "org.opencontainers.image.version": "24.04"
    },
    "ArgsEscaped": true
  },
  "Architecture": "amd64",
  "Os": "linux",
  "Size": 3958331219,
  "GraphDriver": {
    "Data": {
      "LowerDir": "/var/lib/docker/overlay2/8b823cc1c9cace8e399e4e4735388ea838fb0be608f164a8dc2336cbdef03e62/diff:/var/lib/docker/overlay2/a30f3ec8cbf4fe41a5d5914acccbf9a342a5f7ebb11de833d67ab6c753642f90/diff:/var/lib/docker/overlay2/e82a18cc41966c4cd79d1d2f5f4cfc3fc0418fc10faaa5fe76537bed9f602bb4/diff",
      "MergedDir": "/var/lib/docker/overlay2/2ba2c71ec4f9d6710d5f61c81618cf024933575206b35d0f626425f54bb5803b/merged",
      "UpperDir": "/var/lib/docker/overlay2/2ba2c71ec4f9d6710d5f61c81618cf024933575206b35d0f626425f54bb5803b/diff",
      "WorkDir": "/var/lib/docker/overlay2/2ba2c71ec4f9d6710d5f61c81618cf024933575206b35d0f626425f54bb5803b/work"
    },
    "Name": "overlay2"
  },
  "RootFS": {
    "Type": "layers",
    "Layers": [
      "sha256:e8bce0aabd687e9ee90e0bada33884f40b277196f72aac9934357472863a80ae",
      "sha256:5dd749af9956d4605edcb4be27e87b3c4bee3df8515ac7ee0e654e83ef0adb0a",
      "sha256:7f01bee37d3ba3ae9ef986c910e693c39ad53016ec68250d3433b8888659f5e9",
      "sha256:8377067311d639a8208b338fe1775b26d7f5c92881de6b2e216db241ef0dd286"
    ]
  },
  "Metadata": {
    "LastTagTime": "0001-01-01T00:00:00Z"
  }
}

Currently, the ollama container is running on the Linux host. To list detailed information of all the running container(s) in the Linux host, execute the following command in the terminal window:


$ curl -s --unix-socket /var/run/docker.sock "http://foo/containers/json" | jq/p>


The following would be a typical output:


Output.7

[
  {
    "Id": "be7b980c762398a879fd3f1a8a06bb9e1ff58c17effa61375ef5af404fdaa9f7",
    "Names": [
      "/ollama"
    ],
    "Image": "ollama/ollama:0.13.5",
    "ImageID": "sha256:0cab1dbf8bb2a3526530dbb858f8588c9e30e745828af8c8e27575296f8a5261",
    "Command": "/bin/ollama serve",
    "Created": 1766864540,
    "Ports": [
      {
        "IP": "192.168.1.25",
        "PrivatePort": 11434,
        "PublicPort": 11434,
        "Type": "tcp"
      }
    ],
    "Labels": {
      "org.opencontainers.image.ref.name": "ubuntu",
      "org.opencontainers.image.version": "24.04"
    },
    "State": "running",
    "Status": "Up 6 seconds",
    "HostConfig": {
      "NetworkMode": "bridge"
    },
    "NetworkSettings": {
      "Networks": {
        "bridge": {
          "IPAMConfig": null,
          "Links": null,
          "Aliases": null,
          "MacAddress": "7e:bc:1d:d9:8e:ea",
          "DriverOpts": null,
          "GwPriority": 0,
          "NetworkID": "bff0d5cf58e79218bb4e983f86dbb2a7bd5d77550df520c1a85e629845445f2f",
          "EndpointID": "3635ce3dc7b78aacb4583226253b2c42d9dc57484a8d9756b523fc7e70fe6ce6",
          "Gateway": "172.17.0.1",
          "IPAddress": "172.17.0.2",
          "IPPrefixLen": 16,
          "IPv6Gateway": "",
          "GlobalIPv6Address": "",
          "GlobalIPv6PrefixLen": 0,
          "DNSNames": null
        }
      }
    },
    "Mounts": [
      {
        "Type": "bind",
        "Source": "/home/bswamina/.ollama",
        "Destination": "/root/.ollama",
        "Mode": "",
        "RW": true,
        "Propagation": "rprivate"
      }
    ]
  }
]

To list detailed information of all the running available ollama networks, execute the following command in the terminal window:


$ curl -s --unix-socket /var/run/docker.sock http://localhost/networks | jq


The following would be a typical output:


Output.8

[
  {
    "Name": "bridge",
    "Id": "bff0d5cf58e79218bb4e983f86dbb2a7bd5d77550df520c1a85e629845445f2f",
    "Created": "2025-12-27T07:40:02.446611085-05:00",
    "Scope": "local",
    "Driver": "bridge",
    "EnableIPv4": true,
    "EnableIPv6": false,
    "IPAM": {
      "Driver": "default",
      "Options": null,
      "Config": [
        {
          "Subnet": "172.17.0.0/16",
          "Gateway": "172.17.0.1"
        }
      ]
    },
    "Internal": false,
    "Attachable": false,
    "Ingress": false,
    "ConfigFrom": {
      "Network": ""
    },
    "ConfigOnly": false,
    "Containers": {},
    "Options": {
      "com.docker.network.bridge.default_bridge": "true",
      "com.docker.network.bridge.enable_icc": "true",
      "com.docker.network.bridge.enable_ip_masquerade": "true",
      "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
      "com.docker.network.bridge.name": "docker0",
      "com.docker.network.driver.mtu": "1500"
    },
    "Labels": {}
  },
  {
    "Name": "host",
    "Id": "beba450d1ed4169bd102d01957d8b18915e088ab86ad1141b8de25c56538e6d6",
    "Created": "2024-12-22T08:33:54.327412676-05:00",
    "Scope": "local",
    "Driver": "host",
    "EnableIPv4": true,
    "EnableIPv6": false,
    "IPAM": {
      "Driver": "default",
      "Options": null,
      "Config": null
    },
    "Internal": false,
    "Attachable": false,
    "Ingress": false,
    "ConfigFrom": {
      "Network": ""
    },
    "ConfigOnly": false,
    "Containers": {},
    "Options": {},
    "Labels": {}
  },
  {
    "Name": "none",
    "Id": "f394f5dcd563bbefff1a7e009bdb29f7487f96653f84a4cd3702760769f6cf88",
    "Created": "2024-12-22T08:33:54.321118012-05:00",
    "Scope": "local",
    "Driver": "null",
    "EnableIPv4": true,
    "EnableIPv6": false,
    "IPAM": {
      "Driver": "default",
      "Options": null,
      "Config": null
    },
    "Internal": false,
    "Attachable": false,
    "Ingress": false,
    "ConfigFrom": {
      "Network": ""
    },
    "ConfigOnly": false,
    "Containers": {},
    "Options": {},
    "Labels": {}
  }
]

Note that one can perform all the docker operations using curl command, including creating or removing images, starting or stopping containers, etc.

With this, we conclude the short primer on Docker Socket and the hands-on demonstration !!!


References

Official Docker Documentation



© PolarSPARC