admin管理员组文章数量:1403366
I'm trying to set up a GitHub Actions workflow to run tests inside a Docker container. The workflow fails when I attempt to mount a volume from the repository into the Docker container.
- I have a project in a GitHub repository.
- In the GitHub Actions workflow, I am creating a coverage directory inside the
Quality Control
folder. - I am using Docker to run tests and generate the coverage report, and I'm trying to mount the coverage directory into the container.
However, when running the container, I get the following error:
Error response from daemon: invalid mount config for type "bind": bind source path does not exist: /home/runner/work/WebUi/WebUi/QualityControl/coverage
Workflow YAML:
jobs:
coverage:
runs-on: ubuntu-latest
steps:
- name: Create Coverage Directory
run: mkdir -p QualityControl/coverage && ls -ld QualityControl/coverage
- uses: actions/checkout@v4
- run: (cd QualityControl; npm ci)
- run: (cd QualityControl; npm run docker-coverage)
Docker compose configuration:
services:
test_app:
build:
target: coverage
command: ["/opt/wait-for-it.sh", "-t", "0", "test_db:3306", "--", "npm", "run", "coverage-lcov"]
volumes:
- type: bind
source: ./coverage
target: /usr/src/app/coverage
read_only: false
What I’ve Tried:
- I’ve confirmed that the coverage directory exists with mkdir -p and ls.
- I've tried using both absolute and relative paths in docker-compose.yml.
- I’ve ensured the docker-compose command runs within the QualityControl folder.
Despite this, I keep encountering the error that Docker can't find the source path for the volume. Question:
How can I fix the issue where Docker is unable to mount the coverage directory in GitHub Actions? Why is Docker not recognizing the directory even though it is created before the container starts?
I'm trying to set up a GitHub Actions workflow to run tests inside a Docker container. The workflow fails when I attempt to mount a volume from the repository into the Docker container.
- I have a project in a GitHub repository.
- In the GitHub Actions workflow, I am creating a coverage directory inside the
Quality Control
folder. - I am using Docker to run tests and generate the coverage report, and I'm trying to mount the coverage directory into the container.
However, when running the container, I get the following error:
Error response from daemon: invalid mount config for type "bind": bind source path does not exist: /home/runner/work/WebUi/WebUi/QualityControl/coverage
Workflow YAML:
jobs:
coverage:
runs-on: ubuntu-latest
steps:
- name: Create Coverage Directory
run: mkdir -p QualityControl/coverage && ls -ld QualityControl/coverage
- uses: actions/checkout@v4
- run: (cd QualityControl; npm ci)
- run: (cd QualityControl; npm run docker-coverage)
Docker compose configuration:
services:
test_app:
build:
target: coverage
command: ["/opt/wait-for-it.sh", "-t", "0", "test_db:3306", "--", "npm", "run", "coverage-lcov"]
volumes:
- type: bind
source: ./coverage
target: /usr/src/app/coverage
read_only: false
What I’ve Tried:
- I’ve confirmed that the coverage directory exists with mkdir -p and ls.
- I've tried using both absolute and relative paths in docker-compose.yml.
- I’ve ensured the docker-compose command runs within the QualityControl folder.
Despite this, I keep encountering the error that Docker can't find the source path for the volume. Question:
How can I fix the issue where Docker is unable to mount the coverage directory in GitHub Actions? Why is Docker not recognizing the directory even though it is created before the container starts?
Share Improve this question asked Mar 21 at 8:46 Alejandro Mariscal RomeroAlejandro Mariscal Romero 113 bronze badges1 Answer
Reset to default 0Paths can be case sensitive in the workflow yaml you have:
mkdir -p QualityControl/coverage && ls -ld QualityControl/coverage
In the docker compose you have:
target: /usr/src/app/coverage
Whilst this is the target not the source this makes me wonder if you have when specifying the full path varied the case?
版权声明:本文标题:Error mounting volume in Docker with GitHub Actions: 'bind source path does not exist' - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744365653a2602763.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论