AWS CodeBuild - docker: not found

老子叫甜甜 提交于 2019-12-11 13:45:34

问题


I have the following buildspec.yml:

version: 0.2

phases:
  install:
    commands:
      -  curl -L -o sbt-0.13.6.deb http://dl.bintray.com/sbt/debian/sbt-0.13.6.deb && \
      -  dpkg -i sbt-0.13.6.deb && \
      -  rm sbt-0.13.6.deb && \
      -  apt-get update && \
      -  apt-get install sbt && \

  pre_build:
    commands:
      - echo Entered the pre_build phase...
      - docker login -u user -p pass

  build:
    commands:
      - echo Build started on `date`
      - sbt test
      - echo test completed on `date`
      - sbt docker:publishLocal
      - docker tag image repo

  post_build:
    commands:
      - echo Build completed on `date`
      - echo Pushing the Docker image...
      - docker push repo

cache:
  paths:
    - $HOME/.ivy2/cache
    - $HOME/.sbt

and fails with

/codebuild/output/tmp/script.sh: 4: /codebuild/output/tmp/script.sh: docker: not found

in the console. As far as I see in the examples provided in the doc, docker should be already given.

How can I avoid this? Thanks


回答1:


On your CodeBuild project select the "privileged" flag to enable Docker in your build container. If you are using a CodeBuild managed image, then selecting this flag is all that's needed. If you are using a custom image then ensure the Docker is started as explained in https://docs.aws.amazon.com/codebuild/latest/userguide/sample-docker-custom-image.html



来源:https://stackoverflow.com/questions/52882639/aws-codebuild-docker-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!