大网数据广告活动
服务器运维问答

AWS Code Build Error : Cannot connect to docker daemon

· 52CE 我爱测

I was trying to build docker image using aws code build service and then push it to ECR. Commands which i used for it in "buildspec.yml" is specified in below. version: 0.2 phases: install: runtime-versions: docker: 18 pre_build:…

问题原文

原帖链接 · Sreeraju V · CC BY-SA 4.0

I was trying to build docker image using aws code build service and then push it to ECR. Commands which i used for it in "buildspec.yml" is specified in below.

version: 0.2
phases:
  install:
    runtime-versions:
        docker: 18
 pre_build:
      - $(aws ecr get-login --no-include-email --region us-east-1)
      - REPOSITORY_URI=XXXXXXXXXX.dkr.ecr.us-east-1.amazonaws.com/devopswebbuild
      - COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
      - IMAGE_TAG=${COMMIT_HASH:=latest}
  build:
    commands:
      - docker build -t $REPOSITORY_URI:latest .
      - docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG
  post_build:
    commands:
      - docker push $REPOSITORY_URI:latest
      - docker push $REPOSITORY_URI:$IMAGE_TAG


But i am getting error during build process, docker command is unable to connect to docker daemon.Please help me to solve these issue.

Docker build project configuration details is given below:

Build error details is given below:

已采纳解答

原帖链接 · Sreeraju V · CC BY-SA 4.0

I am answering my own question, so it may help some one who is getting same issue. Solution was pretty straightforward, i need to check the privilaged tab which i didn't notice.

Solution :

  1. From the AWS CodeBuild Console, select the Build Project.
  2. Select the 'Edit' dropdown from the top-right corner, and select the 'Environment' option.
  3. Within the 'Edit Environment' page, select 'Override image'. After this, scroll down to find the 'Privileged' option and select it.
  4. Select 'Update Environment' to ensure that the property is updated.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-05-22)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。