sometimes we want to build images that can run on machines with different hardware architectures (mainly arm architectures) to better meet the requirements of a heterogeneous distributed environment. Previously, the usual solution was to prepare multiple machines with different hardware architectures and compile and distribute them separately, but now Docker has a new (albeit experimental) buildx feature that solves this problem nicely.
buildx can be described in the relevant information, and it will not be repeated here. If you want to run locally, you can refer to this article: BUILDING DOCKER IMAGES FOR KUBERNETES RUNNING ON ARM. However, it is difficult to complete the configuration locally according to the actual measurement based on the current network environment, because it needs to connect with Docker.io in the whole process and need to download a large amount of data, so it is likely to disconnect halfway… So take a detour, use some third-party platform to complete the build, and release it to a mirrored warehouse.
I chose github actions because I saw that there were written actions on github, which greatly simplifies the configuration. With this script, you can build an image across the hardware architecture and publish it to docker hub:
docker:
name: Publish Docker Image
runs-on: ubuntu-18.04
env:
REPO: ${{ secrets.ENTITY_DOMAIN_REPO }}
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
version: latest
-
name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
# 可以在这里看到可以兼容哪些平台
- name: Login to Docker Registry
run: echo '${{ secrets.DOCKERHUB_PASS }}' | docker login -u ${{ secrets.DOCKERHUB_USER }} --password-stdin
- name: Build Docker Image
run: docker buildx build -t $REPO:latest --platform linux/amd64,linux/arm64 --push .
# 在--platform后面指定需要兼容的平台列表
div>
Read More:
- Ant Design upload listtype = “picture card” realizes multi image upload and click preview image encapsulation
- Docker starts the image and reports an error. Iptables failed: iptables — wait – t NAT – a docker – P TCP
- Multi environment configuration of springboot under docker
- Centos7 quick installation of docker and configuration of image acceleration
- docker: error pulling image configuration:timeout
- Error reported when Windows builds docker image: failed to create LLB definition: 403 Forbidden
- The method of constructing even order magic square (n = 4 * m)
- Solve “error: failed to commit transaction” in arch Linux
- iOS Failed to find matching arch for 64-bit Mach-O input file
- [docker] error in deleting image: image is referenced in multiple repositories
- Ueditor paste word image and upload image file automatically
- VTK cultivation 26: basic operation of image_ Three dimensional image slice extraction
- [Sovled] Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
- docker: Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled
- systemctl start docker Job for docker.service failed because the control process exited with error
- ImageIO.read () unsupported image type when reading picture_ exception Unsupported Image Type
- Solve Linux docker pull error get https://registry-1.docker.io/v2/ : Net / http: TLS handshake timeout
- Docker start error: failed to start docker application container engine.
- docker Error response from daemon: Bad response from Docker engine
- How to Fix ERROR: Couldn’t connect to Docker daemon at http+docker://localhost – is it running?