【问题标题】:CircleCi: Couldn't connect to Docker daemon at http+docker://localhostCircleCi:无法在 http+docker://localhost 连接到 Docker 守护进程
【发布时间】:2018-06-29 11:04:17
【问题描述】:

在我的 Node.js 项目测试中,我通过 child_process.spawn 开始 docker-compose

运行 CircleCi 时,构建失败并出现以下错误:

Couldn't connect to Docker daemon at http+docker://localhost - is it running?

这是.circleci/config.yml

version: 2
jobs:
  build:
    docker:
      # specify the version you desire here
      - image: circleci/node:8

    working_directory: ~/repo

    steps:
      - checkout

      # Download and cache dependencies
      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "package.json" }}
          # fallback to using the latest cache if no exact match is found
          - v1-dependencies-

      - run: npm install

      - save_cache:
          paths:
            - node_modules
          key: v1-dependencies-{{ checksum "package.json" }}

      # run tests!
      - run: npm test

【问题讨论】:

    标签: docker-compose circleci-2.0


    【解决方案1】:

    我相信最近才遇到这个问题。我认为您的设置中唯一缺少的是setup_remote_docker,然后再运行任何使用docker-compose 的东西。例如:

    working_directory: ~/repo
    
    steps:
      # ...
    
      - setup_remote_docker
    
      # run tests!
      - run: npm test
    

    希望这会有所帮助!

    【讨论】:

      猜你喜欢
      • 2018-12-01
      • 2014-03-19
      • 1970-01-01
      • 2020-02-17
      • 1970-01-01
      • 2016-04-04
      • 2020-06-03
      • 2017-06-14
      • 1970-01-01
      相关资源
      最近更新 更多