# 下载

## Github
[Github](https://github.com/docker/buildx/releases/)

## 网盘
[Alist](https://pan.liumou.site/liumou/189.Mobile/docker/buildx/)

## 效果-网盘

```shell
root@harbor:~# mkdir -p ~/.docker/cli-plugins
root@harbor:~# wget -O ~/.docker/cli-plugins/docker-buildx "https://media-ynkm-fy-person.yn7oss.ctyunxs.cn/PERSONCLOUD/d98a48d4-3289-4d8e-948d-113156ee4bbf?response-content-disposition=attachment%3Bfilename%3D%22buildx-v0.18.0.linux-amd64%22%3Bfilename*%3DUTF-8%27%27buildx-v0.18.0.linux-amd64&x-amz-CLIENTNETWORK=UNKNOWN&x-amz-CLOUDTYPEIN=PERSON&x-amz-CLIENTTYPEIN=PC&Signature=ST6ETH19o4Qy9D7/2J5rvLvD6Sk%3D&AWSAccessKeyId=0Lg7dAq3ZfHvePP8DKEU&x-amz-userLevel=0&Expires=1730966395&x-amz-limitrate=51200&x-amz-FSIZE=57450648&x-amz-UID=177024477935426&x-amz-UFID=623631164754760404"
--2024-11-07 15:56:47--  https://media-ynkm-fy-person.yn7oss.ctyunxs.cn/PERSONCLOUD/d98a48d4-3289-4d8e-948d-113156ee4bbf?response-content-disposition=attachment%3Bfilename%3D%22buildx-v0.18.0.linux-amd64%22%3Bfilename*%3DUTF-8%27%27buildx-v0.18.0.linux-amd64&x-amz-CLIENTNETWORK=UNKNOWN&x-amz-CLOUDTYPEIN=PERSON&x-amz-CLIENTTYPEIN=PC&Signature=ST6ETH19o4Qy9D7/2J5rvLvD6Sk%3D&AWSAccessKeyId=0Lg7dAq3ZfHvePP8DKEU&x-amz-userLevel=0&Expires=1730966395&x-amz-limitrate=51200&x-amz-FSIZE=57450648&x-amz-UID=177024477935426&x-amz-UFID=623631164754760404
正在解析主机 media-ynkm-fy-person.yn7oss.ctyunxs.cn (media-ynkm-fy-person.yn7oss.ctyunxs.cn)... 182.242.93.143, 182.242.93.145, 240e:94c:4000:901::10
正在连接 media-ynkm-fy-person.yn7oss.ctyunxs.cn (media-ynkm-fy-person.yn7oss.ctyunxs.cn)|182.242.93.143|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:57450648 (55M) [application/octet-stream]
正在保存至: “docker-buildx”

docker-buildx                                                      100%[================================================================================================================================================================>]  54.79M  45.8MB/s  用时 1.2s

2024-11-07 15:56:48 (45.8 MB/s) - 已保存 “docker-buildx” [57450648/57450648])

配置

插件配置

root@harbor:~#chmod +x ~/.docker/cli-plugins/docker-buildx

Docker配置

vim /etc/docker/daemon.json

加入下面的内容

{
        "experimental": true,
        "registry-mirrors": [
                "https://dockerpull.com",
                "https://docker.anyhub.us.kg",
                "https://dockerhub.jobcher.com",
                "https://dockerhub.icu",
                "https://docker.awsl9527.cn"
    ]

}

效果:

root@harbor:~# cat /etc/docker/daemon.json
{
        "experimental": true,
        "registry-mirrors": [
                "https://dockerpull.com",
                "https://docker.anyhub.us.kg",
                "https://dockerhub.jobcher.com",
                "https://dockerhub.icu",
                "https://docker.awsl9527.cn"
    ]

}
root@harbor:~#

验证

插件安装验证

root@harbor:~# docker buildx -h
Flag shorthand -h has been deprecated, use --help
Extended build capabilities with BuildKit

Usage:  docker buildx [OPTIONS] COMMAND

Extended build capabilities with BuildKit

Options:
--builder string   Override the configured builder instance
-D, --debug            Enable debug logging

Management Commands:
imagetools  Commands to work on images in registry

Commands:
bake        Build from a file
build       Start a build
create      Create a new builder instance
dial-stdio  Proxy current stdio streams to builder instance
du          Disk usage
inspect     Inspect current builder instance
ls          List builder instances
prune       Remove build cache
rm          Remove one or more builder instances
stop        Stop builder instance
use         Set the current builder instance
version     Show buildx version information

Run 'docker buildx COMMAND --help' for more information on a command.

Experimental commands and flags are hidden. Set BUILDX_EXPERIMENTAL=1 to show them.
root@harbor:~#

Docker验证

root@harbor:~# systemctl daemon-reload && systemctl restart docker
root@harbor:~# docker info | grep -i Experimental
 Experimental: true
root@harbor:~#

安装环境

docker run --privileged --rm registry.cn-hangzhou.aliyuncs.com/liuyi778/binfmt:latest --install all

效果

root@harbor:~# docker run --privileged --rm registry.cn-hangzhou.aliyuncs.com/liuyi778/binfmt:latest --install all
{
  "supported": [
    "linux/amd64",
    "linux/arm64",
    "linux/riscv64",
    "linux/ppc64le",
    "linux/s390x",
    "linux/386",
    "linux/mips64le",
    "linux/mips64",
    "linux/arm/v7",
    "linux/arm/v6"
  ],
  "emulators": [
    "python3.11",
    "qemu-aarch64",
    "qemu-arm",
    "qemu-mips64",
    "qemu-mips64el",
    "qemu-ppc64le",
    "qemu-riscv64",
    "qemu-s390x"
  ]
}
root@harbor:~#