php - 如何在自己的 docker 容器中使用 github 操作/checkout@v2
问题描述
我有自己的 php 图像,我想用它来为我的项目运行测试。
container: rela589n/doctrine-event-sourcing-php:latest
services:
test_db:
image: postgres:13-alpine
env:
POSTGRES_DB: des
POSTGRES_USER: des_user
POSTGRES_PASSWORD: p@$$w0rd
steps:
- uses: actions/checkout@v2
- whatever_needed_to_run_tests_inside_container
这在结帐操作中失败,并出现以下错误:
EACCES: permission denied, open '/__w/doctrine-event-sourcing/doctrine-event-sourcing/6977c4d4-3881-44e9-804e-ae086752556e.tar.gz'
这是合乎逻辑的,因为在新的 docker 容器中没有这样的文件夹结构。我想做的是在提供的虚拟机中运行结帐操作runs-on: ubuntu-20.04
并为 docker 配置卷,以便它可以访问代码。但是,我不知道这样做既不是一个好习惯,也不知道如何实现这一点。我想即使可以这样做,它也不适用于其他操作。
解决方案
Had the same issue when trying to use my own Docker image. In my case, installing everything I need on the fly was not an option, so I had to fix this issue.
It appears that GitHub runs the Docker image with user
1001
named runner
and group
121
named docker
. After adding the group, adding the user and adding the user to sudoers
the problem was solved.
Notice that the checkout path starts with /_w
which is strange. If I perform actions/checkout@v2
without my container, the path is /home/runner
. Not sure how to solve that yet.
推荐阅读
- google-chrome-extension - chrome 扩展的清单文件中的“content_capabilities”字段是什么?
- python - 映射函数和正则表达式?
- excel - Excel VBA - 在下面插入一行,复制公式和格式并在选择列中插入特定的默认数据
- html - 循环一个带有输入的 html 表以获取值
- python-3.x - 这是在 python 中使用 eval() 的安全方法吗?
- python - Python Flask/Django 应用程序中的热重载属性
- c# - C# SMTP 不验证凭据?
- python - 在 windows 上使用 ctypes 为 Python 创建 C Wrapper
- vue.js - 带有@click的Vuejs v-movable不起作用
- animation - d3动画多行该行无法完成