AWS CodeBuild - docker:未找到

AWS CodeBuild - docker: not found

我有以下 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

并失败

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

在控制台中。据我在文档中提供的示例中看到的那样,docker 应该已经给出了。

我怎样才能避免这种情况? 谢谢

在您的 CodeBuild 项目上 select "privileged" 标志以在您的构建容器中启用 Docker。如果您使用的是 CodeBuild 托管图像,那么 selecting 这个标志就足够了。如果您使用的是自定义图像,请确保 Docker 已按照 https://docs.aws.amazon.com/codebuild/latest/userguide/sample-docker-custom-image.html

中的说明启动