Docker Service Management
Start Docker Daemon Manually
Unix Socket
The Unix socket is an IPC (inter-process communication) mechanism that enables communication between Docker clients (CLI, SDK) and the Docker Daemon on the same host. When the Docker daemon starts, it listens on an internal Unix Socket at/var/run/docker.sock. When a container is built, this socket file from the host is mounted into the container’s filesystem, allowing the container to access the Docker Daemon API via the Docker CLI.
By default, the Docker Daemon only listens on the Unix Socket. It can also be configured to listen on a TCP interface:
192.168.0.196— IP address of the host machine2375— Standard port for Docker (unencrypted traffic)
TLS Encryption
Fix the unencrypted TCP issue by enabling TLS:When TLS is enabled, use port 2376 (the standard port for encrypted Docker traffic).
Certificate-Based Authentication
TLS encryption alone still allows anyone to access the daemon. Enable certificate-based authentication for full security:--tlsverify— Enables client authentication--tlscacert— CA certificate used to verify client certificates
client.pem and clientkey.pem, then set:
daemon.json Configuration File
Instead of passing all flags todockerd manually, move configuration to /etc/docker/daemon.json:
"live-restore": true — Containers continue running even when the Docker Daemon stops.
After editing daemon.json, reload Docker:
Logging Driver
Use
docker logs to retrieve container logs. Container logs are stored at /var/lib/docker/containers/<id>.json by default.docker system info.
Available logging drivers:
| Driver | Description |
|---|---|
json-file | Default. Stores logs as JSON files on disk. |
none | No logging. |
syslog | Sends logs to the syslog daemon. |
local | Custom local logging. |
journald | Sends logs to journald (use docker logs to read). |
splunk | Sends logs to Splunk. |
awslogs | Sends logs to Amazon CloudWatch. |
Storage Driver
Docker uses storage drivers to store image layers and data in the writable layer of a container. The storage driver controls how images and containers are stored and managed on your Docker host. — docker.docsSupported storage drivers:
overlay2btrfsandzfsvfsfuse-overlayfs
/etc/docker/daemon.json: