[英]Using a specific docker version in github actions
I want to use github actions to test the sbt-native-packager docker integration, which builds docker images from Dockerfiles.我想使用 github 操作来测试sbt-native-packager docker集成,它从 Dockerfiles 构建 docker 图像。
The issue is that github actions seems to use an either old or custom docker version.问题是 github 操作似乎使用旧的或自定义的 docker 版本。
3.0.8
is detected as version. 3.0.8
被检测为版本。 See a failed integration test run , which states查看失败的集成测试运行,其中指出
[1] The detected Docker version DockerVersion(3,0,8,None) is not compatible with DockerPermissionStrategy.MultiStage
[1] 检测到的 Docker 版本 DockerVersion(3,0,8,None) 与 DockerPermissionStrategy.MultiStage 不兼容
I want to use the latest docker version 19.x which allows us to test all features.我想使用最新的 docker 版本 19.x,它允许我们测试所有功能。 Ideally I'm able to set different docker versions for different test scenarios, but that would be only nice to have.
理想情况下,我能够为不同的测试场景设置不同的 docker 版本,但这只会很好。
Update更新
The output of my debug docker github action 我的调试 docker github 操作的输出
docker version
Client:
Version: 3.0.8
API version: 1.40
Go version: go1.12.10
Git commit: 2355349d
Built: Wed Oct 23 17:47:59 2019
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: 3.0.8
API version: 1.40 (minimum version 1.12)
Go version: go1.12.10
Git commit: adfac69
Built: Wed Oct 23 17:54:47 2019
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.2.10
GitCommit: b34a5c8af56e510852c35414db4c1f4fa6172339
runc:
Version: 1.0.0-rc8+dev
GitCommit: 3e425f80a8c931f88e6d94a8c831b9d5aa481657
docker-init:
Version: 0.18.0
GitCommit: fec3683
and和
docker --version
Docker version 3.0.8, build 2355349d
thanks in advance, Muki提前致谢, Muki
You can install the latest version of docker using the Ubuntu installation approach!您可以使用 Ubuntu 安装方法安装最新版本的 docker!
In your workflow, set up the VM to install docker and then check the version.在您的工作流程中,设置 VM 以安装 docker,然后检查版本。 I've verified it in this workflow and posted the YAML here:
我已在此工作流程中对其进行了验证,并在此处发布了 YAML:
name: Check Docker Version
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check Docker Version
run: docker --version
- name: Install Latest Docker
run: |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install docker-ce
- name: Check Docker Version
run: docker --version
It might get tedious to have to install docker
with every build but at least you can control the version that way.每次构建都必须安装
docker
可能会很乏味,但至少您可以通过这种方式控制版本。 :D :D
I should add that each step in the job will have access to the version you install.我应该补充一点,工作中的每个步骤都可以访问您安装的版本。 If you need to use docker in another job , you'll have to install docker for the new compute resource.
如果您需要在另一个作业中使用 docker,则必须为新的计算资源安装 docker。
It turns out that the server version is arbitrary while the api version is the relevant version to look for.事实证明,服务器版本是任意的,而api版本是要查找的相关版本。
Related resources相关资源
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.