Docker Docker Engine & Compose Error dial-unix-docker-sock: Permission Denied: dial unix /var/run/docker.sock
This error occurs when a non-root user executes the `docker` CLI command without having read/write permissions on the UNIX domain socket `/var/run/docker.sock`, or when the Docker systemd daemon service is not running.
Hardware Diagnostic Matrix
Spec Ref #b00f933aRequired Diagnostic Tools & Instrumentation
Multimeter Probing Targets & Circuit Tolerances
Bench Calibrated ±5%| Test Point / Circuit | Target Nominal Spec | Expected State | Fault Condition |
|---|---|---|---|
| Main Logic DC Bus | 3.3V / 5.0V DC (±0.1V) | Stable DC Potential | <2.9V (Brownout / Sag) |
| Thermistor / NTC Sensor | 10kΩ - 100kΩ @ 25°C | Smooth Thermal Curve | 0Ω (Short) or ∞ (Open) |
| Safety Ground / PE Continuity | < 0.5Ω Resistance | Solid Earth Bond | > 1.0Ω (Floating Chassis) |
Common Symptoms & Fault Manifestations
- `permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock` in terminal
- `docker ps`, `docker run` or `docker compose up` fails instantly
- CI/CD pipeline jobs crash with exit code 1
Root Causes & System Failure Modes
Current user is not a member of the local `docker` security group
The `docker.service` or `docker.socket` systemd unit is inactive or stopped
Permissions on `/var/run/docker.sock` altered by a third-party security package or umask
Rootless Docker configuration conflict
High-Voltage & Mechanical Safety Isolation
Prior to opening access panels, disconnecting terminals, or probing wiring, perform complete lock-out / tag-out (LOTO). Disconnect all AC mains, DC string isolators, and lithium battery banks. Allow internal smoothing capacitors at least 3 to 5 minutes to dissipate stored residual energy below safe threshold (<30VDC).
Step-by-Step Diagnostic & Resolution Procedure
Add Current User to the Docker Group
Execute: `sudo usermod -aG docker $USER`. This grants standard socket access without requiring root prefix.
Refresh User Group Session
Apply group membership immediately without logging out by running: `newgrp docker` (or log out and re-log into your terminal session).
Verify Docker Service Status
Check if the daemon is actively running: `sudo systemctl status docker`. If inactive, start and enable it: `sudo systemctl enable --now docker`.
Inspect Socket Permissions
Inspect the socket: `ls -la /var/run/docker.sock`. It should show ownership `root:docker` with permissions `srw-rw----`.
Hardware Reset & Fault Clear Sequence
Controller ProcedurePrevention & Routine Maintenance Guidelines
- Add deployment users to the `docker` group during Ansible/Cloud-init VM provisioning
- Never use `chmod 777 /var/run/docker.sock` as it introduces severe container breakout vulnerabilities
Frequently Asked Diagnostic Questions
What does error code dial-unix-docker-sock indicate on Docker Docker Engine & Compose?
This error occurs when a non-root user executes the `docker` CLI command without having read/write permissions on the UNIX domain socket `/var/run/docker.sock`, or when the Docker systemd daemon service is not running. In engineering telemetry, it indicates permission denied: dial unix /var/run/docker.sock requiring circuit verification.
What are the primary triggers causing error dial-unix-docker-sock?
Diagnostic bench telemetry isolates the following common root causes: Current user is not a member of the local `docker` security group; The `docker.service` or `docker.socket` systemd unit is inactive or stopped; Permissions on `/var/run/docker.sock` altered by a third-party security package or umask; Rootless Docker configuration conflict.
How do I reset and clear Docker error dial-unix-docker-sock?
Run `sudo systemctl restart docker` to recreate the clean UNIX socket file with default permissions. If the error status repeats immediately after clearing, discontinue clearing and test circuit continuity.
Can I safely resolve error dial-unix-docker-sock without specialized shop tooling?
This fault is graded as Easy difficulty with Medium severity. Standard diagnostics require an insulated digital multimeter and appropriate hand tools. Always observe high-voltage isolation procedures.