【问题标题】:Docker Compose bind mount doesn't work in GitHub ActionsDocker Compose 绑定挂载在 GitHub Actions 中不起作用
【发布时间】:2020-07-09 15:13:51
【问题描述】:

如果我在使用绑定挂载的 GitHub Actions 中运行 Docker Compose 命令,它会显示源目录不存在。这是错误。

Cannot create container for service chat: invalid mount config for type "bind": bind source path does not exist: /__w/omni-chat/omni-chat

我认为问题在于根目录被错误地传递给 GitHub Actions。我将绝对路径指定为常规的.,但我不知道 GitHub Actions 对此有何警告。

这是我的工作流程的简化版本。

on: push
jobs:
  test-server:
    runs-on: ubuntu-latest
    container: docker/compose
    steps:
      - uses: actions/checkout@v2
      - run: docker-compose run --rm chat gradle test

这是我的 Docker Compose 文件的简化版本。

version: '3.7'
services:
  chat:
    image: gradle:6.3-jdk8
    command: bash
    volumes:
      - type: bind
        source: .
        target: /home/gradle
      - type: volume
        source: gradle-cache
        target: /home/gradle/.gradle
volumes:
  gradle-cache:

如果您需要完整的详细信息,请联系exact run

【问题讨论】:

    标签: docker-compose github-actions


    【解决方案1】:

    事实证明,您应该使用预安装的 Docker Compose 安装。因此,只需删除指定的 container 即可允许绑定挂载工作,因为它不再是 Docker-in-Docker 场景。

    【讨论】:

      猜你喜欢
      • 2018-11-03
      • 2017-05-09
      • 2019-01-09
      • 2021-08-08
      • 1970-01-01
      • 1970-01-01
      • 2021-05-08
      • 2019-02-26
      • 2018-09-24
      相关资源
      最近更新 更多