Skip to content

Instantly share code, notes, and snippets.

@wingkwong
Created October 13, 2021 15:45
Show Gist options
  • Save wingkwong/6139f47142d96fda71a25c5588ff1da4 to your computer and use it in GitHub Desktop.
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
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