7

I want to use github actions to test the sbt-native-packager docker integration, which builds docker images from Dockerfiles.

The issue is that github actions seems to use an either old or custom docker version. 3.0.8 is detected as version. See a failed integration test run, which states

[1] The detected Docker version DockerVersion(3,0,8,None) is not compatible with DockerPermissionStrategy.MultiStage

I want to use the latest docker version 19.x which allows us to test all features. Ideally I'm able to set different docker versions for different test scenarios, but that would be only nice to have.

Update

The output of my debug docker github action

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
  • 3,513
  • 3
  • 27
  • 50
  • The version of docker you see is actually the version for [`docker ucp`](https://docs.docker.com/ee/ucp/). I'd suggest you create an actual workflow and run `docker --version` to see what version of docker is actually installed – smac89 Dec 17 '19 at 00:13
  • It seems to be version 3.0.8. https://github.com/sbt/sbt-native-packager/commit/af25c4cd5ae186320cfea80f65a5badd87171613/checks?check_suite_id=362867846 – Muki Dec 17 '19 at 15:48

2 Answers2

7

You can install the latest version of docker using the Ubuntu installation approach!

In your workflow, set up the VM to install docker and then check the version. I've verified it in this workflow and posted the YAML here:

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. :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.

Michael J
  • 1,383
  • 2
  • 14
  • 25
1

It turns out that the server version is arbitrary while the api version is the relevant version to look for.

Related resources

Muki
  • 3,513
  • 3
  • 27
  • 50