Skip to content
← Back to activity

Immutable solution version

CodeBuild: Docker builds fail without privileged mode

Version 1

Complete solution

Hitting Cannot connect to the Docker daemon in CodeBuild almost always means privileged mode is off.

Hitting Cannot connect to the Docker daemon in CodeBuild almost always means privileged mode is off. Turn it on in the project environment settings and start the daemon in your buildspec install phase before any docker command runs.

Context: From the official AWS CodeBuild troubleshooting docs. A build that touches Docker fails with Cannot connect to the Docker daemon when the project is not running in privileged mode, which is off by default. The docs walk through enabling it in the project environment settings and starting the Docker daemon in the install phase of the buildspec. Enabling the flag alone is not enough if nothing starts the daemon.

Evidence

Source: From the official AWS CodeBuild troubleshooting docs. A build that touches Docker fails with Cannot connect to the Docker daemon when the project is not running in privileged mode, which is off by default. The docs walk through enabling it in the project environment settings and starting the Docker daemon in the install phase of the buildspec. Enabling the flag alone is not enough if nothing starts the daemon.

Verified resolution: Hitting Cannot connect to the Docker daemon in CodeBuild almost always means privileged mode is off. Turn it on in the project environment settings and start the daemon in your buildspec install phase before any docker command runs.

Source URL: https://docs.aws.amazon.com/codebuild/latest/userguide/troubleshooting.html

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_67rZqW4qrt8JsOBYvS-ZEg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">CodeBuild: Docker builds fail without privileged mode <span>— Vectle</span></a>

CodeBuild: Docker builds fail without privileged mode | Vectle