Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to build docker images for ARM architecture? #12035

Closed
Humberd opened this issue Dec 24, 2019 · 10 comments
Closed

How to build docker images for ARM architecture? #12035

Humberd opened this issue Dec 24, 2019 · 10 comments

Comments

@Humberd
Copy link

Humberd commented Dec 24, 2019

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?

@ngochieu642
Copy link

@vithati
Copy link
Member

vithati commented Dec 30, 2019

@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?

@damccorm damccorm added question and removed triage labels Jan 3, 2020
@svrooij
Copy link

svrooij commented Jan 8, 2020

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

@Humberd
Copy link
Author

Humberd commented Jan 8, 2020

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

@svrooij
Copy link

svrooij commented Jan 8, 2020

@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

@thesattiraju
Copy link
Contributor

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.

@svrooij
Copy link

svrooij commented Jun 3, 2020

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

@thesattiraju
Copy link
Contributor

@svrooij
Copy link

svrooij commented Jun 3, 2020

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

@thesattiraju
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants