Azure-pipelines-tasks: How to build docker images for ARM architecture?

Created on 25 Dec 2019  路  10Comments  路  Source: microsoft/azure-pipelines-tasks

I'm trying to target amd64 and armv7 architectures at for a single docker image. There is an experimental docker feature called buildx which allows that, however, the current versions of docker on VMs are 1 year old and don't have this feature.

How can I build targetting ARM?

Release question

Most helpful comment

Let me check with my PMs about introducing the buildx-installer.

The documentation about buildx is on https://docs.docker.com/buildx/working-with-buildx/ it requires the experimental flag in the docker config to true and a separate docker cli extension package. installing buildx.

This seems like a file write operation to $DOCKER_CONFIG/config.json file, right? If you want this to be a default experience on the hosted agents, you'll have to raise a PR in https://github.com/actions/virtual-environments repository.
But before you do that, you could simply edit it using some powershell commands as well. Although the cleaner way could have been if docker-cli provided a command to enable experimental features.

All 10 comments

@Humberd . "however, the current versions of docker on VMs are 1 year old and don't have this feature." are you referring on hosted agents?

Building a docker image for multiple architectures is made much easier with the use of buildx as in setting it up and just running

docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 -t somerepo:latest --push .

No need for manually changing the image manifest or dealing with qemu stuff. But it doesn't work in pipelines.

Maybe the title of this issue should be Please enable support for docker buildx command on hosted agents

@svrooij Docker is too old, and it doesnt support it in its version

@Humberd You can update docker with following task (still no luck by the way)...

    - task: DockerInstaller@0
      inputs:
        dockerVersion: '19.03.5'
Client: Docker Engine - Community
 Version:           19.03.5
 API version:       1.40
 Go version:        go1.12.12
 Git commit:        633a0ea838
 Built:             Wed Nov 13 07:22:05 2019
 OS/Arch:           linux/amd64
 Experimental:      true

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
Client:
 Debug Mode: false

The current version of docker on hosted agents is 19.03.5 so you're free to run buildx commands by using the commandLine task.

Closing stale issue, feel free to re-open if you want to continue the discussion.

Is there a sample on how to build docker images using buildx? That would be great!!

@ds-ms The blog post is about github actions. And it says you still need a separate action to install buildx. I'm guessing this is also the case on Azure Pipelines, which is why I was asking about it in the first place.

The documentation about buildx is on https://docs.docker.com/buildx/working-with-buildx/ it requires the experimental flag in the docker config to true and a separate docker cli extension package. installing buildx.

And here is the github action that installs buildx on demand (in github actions). This might need to be converted to be used in Azure pipelines.

Let me check with my PMs about introducing the buildx-installer.

The documentation about buildx is on https://docs.docker.com/buildx/working-with-buildx/ it requires the experimental flag in the docker config to true and a separate docker cli extension package. installing buildx.

This seems like a file write operation to $DOCKER_CONFIG/config.json file, right? If you want this to be a default experience on the hosted agents, you'll have to raise a PR in https://github.com/actions/virtual-environments repository.
But before you do that, you could simply edit it using some powershell commands as well. Although the cleaner way could have been if docker-cli provided a command to enable experimental features.

Was this page helpful?
0 / 5 - 0 ratings