3

I am playing around with Docker buildx to build some images for linux/arm/v7. However, I would like to do it programmatically. I know that there is an HTTP api to interact with the Docker daemon for standard functions, however the Docker docs do not show any information about the Docker buildx api.

For example, I would like to run "docker buildx build --platform linux/arm/v7 -t foo/bar:latest ." programmatically.

Has anyone tried it?

jww
  • 97,681
  • 90
  • 411
  • 885
PptSbzzgt
  • 351
  • 1
  • 3
  • 10

2 Answers2

3

I don't know what is your requirement to use buildx but there is SDK in Python

https://docker-py.readthedocs.io/en/stable/

You can use this API client for the purpose to use docker programmatically.

Prateek Sen
  • 392
  • 2
  • 9
1

I am going to post here what I ended up doing, since it might be useful. There is an option in docker buildx that allows to set the default builder instance to use:

docker buildx use <instance name>

The HTTP api will then apply whatever build request to that instance.

PptSbzzgt
  • 351
  • 1
  • 3
  • 10
  • 2
    I have the same question here. I am trying to use com.github.dockerjava.core. I can easily issue the command-line as mentioned by @PptSbzzgt. However, I would like to use the Java library to 'list' and 'use' the buildx builder. Any help? – Arvin Feb 06 '21 at 17:29