简体   繁体   English

在私有 docker 容器中运行整个 GitHub 操作工作流作业

[英]Run entire GitHub Actions workflow job in private docker container

I am trying to use the container option in a GitHub Actions workflow to run the entire job in a docker container.我正在尝试在 GitHub 操作工作流中使用container选项来在 docker 容器中运行整个作业。 How do I specify the login credentials to retrieve this docker image from a private repository on docker hub?如何指定登录凭据以从 docker 集线器上的私有存储库中检索此 docker 映像?

jobs:
  build:
    runs-on: ubuntu-18.04
    container: private_org/test-runner:1.0

I have successfully used the following docker-login "action" to authenticate with docker hub as a "step", but this does not get performed until after the job-level container gets initialized.我已成功使用以下 docker docker-login “操作”来通过 docker 集线器作为“步骤”进行身份验证,但这直到作业级容器初始化后才会执行。

jobs:
  build:
    runs-on: ubuntu-18.04
    steps:
    - uses: azure/docker-login@v1
      with:
        username: me
        password: ${{ secrets.MY_DOCKERHUB_PASSWORD }}
    - name: test docker creds
      run: docker pull private_org/test-runner:1.0

This was implemented recently.这是最近实施的。 Use the following workflow definition:使用以下工作流定义:

jobs:
  build:
    container:
      image: private_org/test-runner:1.0
      credentials:
        username: me
        password: ${{ secrets.MY_DOCKERHUB_PASSWORD }}

Source: https://github.blog/changelog/2020-09-24-github-actions-private-registry-support-for-job-and-service-containers/来源: https://github.blog/changelog/2020-09-24-github-actions-private-registry-support-for-job-and-service-containers/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 GitHub 操作:获取所有作业命令以在 Docker 容器中运行 - GitHub Actions: Get all job commands to run in a Docker container Github 操作工作流到 docker 容器环境 - Github actions workflow to docker container environment docker 在 Github 上运行 dynamodb-local 操作工作流挂起 - docker run dynamodb-local on Github Actions Workflow hanging Vuejs 到 Github Actions 中的 docker 容器 - Vuejs to docker container in Github Actions 如何在 GitHub Actions 中失败时重新运行 docker 容器,但工作流仍然通过? - How to rerun a docker container on failure in GitHub Actions, but still have the workflow pass? Github 将容器推送到 Github 容器注册表的操作工作流程失败并显示“未经身份验证” - Github Actions workflow for pushing a container to Github Container Registry fails with "unauthenticated" 当我使用私有容器时,GitHub Actions flutter-action 作业失败 - GitHub Actions flutter-action job fails when I use a private container Github actions 在容器中运行步骤 - Github actions run steps in container 您如何构建 docker 映像并将其用作 GitHub 操作中下一个作业的容器? - How do you build a docker image and use it as the container for the next job in GitHub actions? 具有数据库依赖性的 Docker Github 工作流:没有这样的容器 - Docker Github workflow with database dependency: No such container
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM