dockersbt-native-packagergithub-actions

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.

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


Solution

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