Created
October 13, 2021 15:45
-
-
Save wingkwong/6139f47142d96fda71a25c5588ff1da4 to your computer and use it in GitHub Desktop.
Fixing "Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?" on AWS CodeBuild with a custom docker image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 0.2 | |
phases: | |
install: | |
commands: | |
- nohup /usr/local/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 --storage-driver=overlay2 & | |
# If the base operating system is Alpine Linux, in the buildspec.yml add the -t argument to timeout: | |
- timeout 15 sh -c "until docker info; do echo .; sleep 1; done" | |
pre_build: | |
commands: | |
- docker build -t helloworld . | |
build: | |
commands: | |
- docker images | |
- docker run helloworld echo "Hello, World!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment