Docker操作的新位置 [英] New location of docker actions

查看:69
本文介绍了Docker操作的新位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将其用于docker:

 -名称:构建容器映像
使用:actions / docker / cli @ master
,其中:
/////已删除

-名称:Docker Login
使用:actions / docker / login @ master
env :
//////删除了

但是github.com/actions/docker不似乎已经存在了。



我的版本正在提供404:


失败下载action' https://api.github.com/repos/actions/docker / tarball / master 。错误响应状态代码不表示成功:404(未找到)。


有人知道新位置吗?

解决方案

actions / docker 操作现已被弃用。在将其完全删除之前,已使用以下消息对存储库进行了归档。


不建议使用此操作,而建议在新存储库中使用run脚本步骤。使用YAML语言运行docker cli。


因此,推荐的使用Docker的方法是使用 run 脚本命令。正式的入门工作流程显示了一个简单的示例来构建图像。
https://github.com/ actions / starter-workflows / blob / master / ci / docker-image.yml



有关Docker映像发布的更完整示例,请参见以下工作流程。 / p>

对于公共DockerHub注册中心:

 名称:我的工作流程
开:
推:
分支机构:
-主
工作:
构建:
运行:ubuntu最新
步骤:
-使用:actions / checkout @ v2
-名称:登录DockerHub注册表
运行:echo $ {{secrets.DOCKERHUB_PASSWORD}} | docker login -u $ {{secrets.DOCKERHUB_USERNAME}} --password-stdin
-名称:构建Docker映像
运行:docker build -t myimage:latest。
-名称:标记Docker映像
运行:docker标签myimage:latest myimage:1.0
-名称:将Docker映像推送至注册表
运行:docker push myimage:1.0

对于私有注册表,例如新的GitHub Package Registry,您还需要在以下情况下指定主机名:登录并正确标记图像:

 名称:我的工作流程
启用:
推送:
分支机构:
-主
工作:
构建:
运行:ubuntu最新
步骤:
-用法:动作/结帐@ v2
-名称:登录GitHub软件包注册表
运行:echo $ {{secrets.GITHUB_TOKEN}} |泊坞窗登录docker.pkg.github.com -u $ {{github.repository}} --password-stdin
-名称:构建Docker映像
运行:docker build -t myimage:latest。
-名称:标记Docker映像
运行:docker标签myimage:latest docker.pkg.github.com/username/repository/myimage:1.0
-名称:将Docker映像推送到注册表
运行:docker push docker.pkg.github.com/username/repository/myimage:1.0


I was using this for docker:

- name: Build container image
  uses: actions/docker/cli@master
  with:
    ///// removed

- name: Docker Login
  uses: actions/docker/login@master
  env:
    ///// removed

However github.com/actions/docker do not seem to exist anymore.

My builds are giving 404:

Failed to download action 'https://api.github.com/repos/actions/docker/tarball/master'. Error Response status code does not indicate success: 404 (Not Found).

Does anyone know the new location?

解决方案

The actions/docker action has now been deprecated. The repository was archived with the following message before being deleted entirely.

This action is deprecated in favor of using the run script step in the new YAML language to run the docker cli.

So the recommended way to use Docker is to use the run script command. The official starter workflow shows a simple example to build an image. https://github.com/actions/starter-workflows/blob/master/ci/docker-image.yml

For more complete examples of Docker image publishing see the following workflows.

For the public DockerHub registry:

name: my workflow
on:
  push:
    branches:
      - master
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Login to DockerHub Registry
        run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
      - name: Build the Docker image
        run: docker build -t myimage:latest .
      - name: Tag the Docker image
        run: docker tag myimage:latest myimage:1.0
      - name: Push the Docker image to the registry
        run: docker push myimage:1.0

For a private registry, such as the new GitHub Package Registry, you also need to specify the hostname when logging in and tag the image appropriately:

name: my workflow
on:
  push:
    branches:
      - master
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Login to GitHub Package Registry
        run: echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u ${{ github.repository }} --password-stdin
      - name: Build the Docker image
        run: docker build -t myimage:latest .
      - name: Tag the Docker image
        run: docker tag myimage:latest docker.pkg.github.com/username/repository/myimage:1.0
      - name: Push the Docker image to the registry
        run: docker push docker.pkg.github.com/username/repository/myimage:1.0

这篇关于Docker操作的新位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆