One root cause of this error is that Docker socket not being properly mounted into the agent. Here are some things to check:
- check the agents --volume=/var/run/docker.sock:/var/run/docker.sock
- make sure the mapping is correct
- make sure the socket exists on the host machine. Some linux distributions, such as centos and coreos, may write the socket at a different location.
- make sure Drone does not start before the Docker socket is initialized
- if Docker restarts, you must restart the agent. Note that Docker could randomly restart due to a panic (there are documented issues in the moby issue tracker)
- please make sure you are running the very latest Docker version (and Drone for that matter). This helps avoid troubleshooting issues that have already been resolved
Another common root cause is people trying to use agents, but not properly configuring the server for multi-machine mode. You must explicitly configure the Drone server to use agents, otherwise the Drone server defaults to single-machine mode. When running in single-machine mode, the Drone server attempts to connect to the host machine Docker socket to launch builds instead of delegating to agents. If you are trying to configure Drone with agents, please double-check your configuration and ensure you are passing DRONE_AGENTS_ENABLED=true to the server.