问题
[root@ningan ~]
docker: 'buildx' is not a docker command.
See 'docker --help'
环境
[root@ningan ~]
Linux ningan 5.4.0-150-generic
[root@ningan ~]
Client:
Version: 20.10.21
API version: 1.41
Go version: go1.18.1
Git commit: 20.10.21-0ubuntu1~18.04.3
Built: Thu Apr 27 05:50:21 2023
OS/Arch: linux/amd64
Context: default
Experimental: true
Server:
Engine:
Version: 20.10.21
API version: 1.41 (minimum version 1.12)
Go version: go1.18.1
Git commit: 20.10.21-0ubuntu1~18.04.3
Built: Thu Apr 27 05:36:22 2023
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.6.2
GitCommit: de8046a5501db9e0e478e1c10cbcfb21af4c6b2d
runc:
Version: 1.1.1
GitCommit: v1.1.0-20-g52de29d7
docker-init:
Version: 0.19.0
GitCommit:
[root@ningan ~]
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
解决办法
尝试1:修改~/.docker /config.json
[root@ningan ~]
mkdir: cannot create directory ‘/root/.docker’: File exists
[root@ningan ~]
[root@ningan .docker]
total 24
drwx------ 3 root root 4096 Jan 23 14:20 ./
drwx------ 68 root root 4096 Feb 20 10:53 ../
-rw------- 1 root root 447 Jan 23 14:20 config.json
drwxr-xr-x 85 root root 12288 Jan 23 14:55 manifests/
[root@ningan ~]
{
...
"experimental": "enabled"
}
[root@ningan .docker]
docker: 'buildx' is not a docker command.
See 'docker --help'
[root@ningan .docker]
Client:
Version: 20.10.21
API version: 1.41
Go version: go1.18.1
Git commit: 20.10.21-0ubuntu1~18.04.3
Built: Thu Apr 27 05:50:21 2023
OS/Arch: linux/amd64
Context: default
Experimental: true
Server:
Engine:
Version: 20.10.21
API version: 1.41 (minimum version 1.12)
Go version: go1.18.1
Git commit: 20.10.21-0ubuntu1~18.04.3
Built: Thu Apr 27 05:36:22 2023
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.6.2
GitCommit: de8046a5501db9e0e478e1c10cbcfb21af4c6b2d
runc:
Version: 1.1.1
GitCommit: v1.1.0-20-g52de29d7
docker-init:
Version: 0.19.0
GitCommit:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
尝试2:exporter DOCKER_CLI_EXPERIMENTAL=enabled
[root@ningan .docker]
[root@ningan .docker]
[root@ningan .docker]
docker: 'buildx' is not a docker command.
See 'docker --help'
[root@ningan .docker]
Client:
Version: 20.10.21
API version: 1.41
Go version: go1.18.1
Git commit: 20.10.21-0ubuntu1~18.04.3
Built: Thu Apr 27 05:50:21 2023
OS/Arch: linux/amd64
Context: default
Experimental: true
Server:
Engine:
Version: 20.10.21
API version: 1.41 (minimum version 1.12)
Go version: go1.18.1
Git commit: 20.10.21-0ubuntu1~18.04.3
Built: Thu Apr 27 05:36:22 2023
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.6.2
GitCommit: de8046a5501db9e0e478e1c10cbcfb21af4c6b2d
runc:
Version: 1.1.1
GitCommit: v1.1.0-20-g52de29d7
docker-init:
Version: 0.19.0
GitCommit:
[root@ningan .docker]
WARNING: No swap limit support
Experimental: false
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
尝试3:修改/etc/docker/daemon.json --> Experimental成功开启
[root@ningan .docker]
{
"experimental": true,
...
}
[root@ningan .docker]
[root@ningan .docker]
WARNING: No swap limit support
Experimental: true
[root@ningan ~]
Client:
Version: 20.10.21
API version: 1.41
Go version: go1.18.1
Git commit: 20.10.21-0ubuntu1~18.04.3
Built: Thu Apr 27 05:50:21 2023
OS/Arch: linux/amd64
Context: default
Experimental: true
Server:
Engine:
Version: 20.10.21
API version: 1.41 (minimum version 1.12)
Go version: go1.18.1
Git commit: 20.10.21-0ubuntu1~18.04.3
Built: Thu Apr 27 05:36:22 2023
OS/Arch: linux/amd64
Experimental: true
containerd:
Version: v1.6.2
GitCommit: de8046a5501db9e0e478e1c10cbcfb21af4c6b2d
runc:
Version: 1.1.1
GitCommit: v1.1.0-20-g52de29d7
docker-init:
Version: 0.19.0
GitCommit:
[root@ningan ~]
docker: 'buildx' is not a docker command.
See 'docker --help
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
尝试4:开启binfmt
[root@ningan ~]
Unable to find image 'tonistiigi/binfmt:latest' locally
latest: Pulling from tonistiigi/binfmt
8d4d64c318a5: Pull complete
e9c608ddc3cb: Pull complete
Digest: sha256:66e11bea77a5ea9d6f0fe79b57cd2b189b5d15b93a2bdb925be22949232e4e55
Status: Downloaded newer image for tonistiigi/binfmt:latest
installing: riscv64 OK
installing: mips64le OK
installing: ppc64le OK
installing: mips64 OK
installing: arm64 OK
installing: arm OK
installing: s390x OK
{
"supported": [
"linux/amd64",
"linux/arm64",
"linux/riscv64",
"linux/ppc64le",
"linux/s390x",
"linux/386",
"linux/mips64le",
"linux/mips64",
"linux/arm/v7",
"linux/arm/v6"
],
"emulators": [
"jar",
"llvm-6.0-runtime.binfmt",
"python2.7",
"python3.6",
"qemu-aarch64",
"qemu-arm",
"qemu-mips64",
"qemu-mips64el",
"qemu-ppc64le",
"qemu-riscv64",
"qemu-s390x"
]
}
[root@ningan ~]
[root@ningan ~]
total 0
-rw-r--r-- 1 root root 0 Feb 4 21:40 jar
-rw-r--r-- 1 root root 0 Feb 4 21:40 llvm-6.0-runtime.binfmt
-rw-r--r-- 1 root root 0 Feb 4 21:40 python2.7
-rw-r--r-- 1 root root 0 Feb 4 21:40 python3.6
-rw-r--r-- 1 root root 0 Feb 20 11:29 qemu-aarch64
-rw-r--r-- 1 root root 0 Feb 20 11:29 qemu-arm
-rw-r--r-- 1 root root 0 Feb 20 11:29 qemu-mips64
-rw-r--r-- 1 root root 0 Feb 20 11:29 qemu-mips64el
-rw-r--r-- 1 root root 0 Feb 20 11:29 qemu-ppc64le
-rw-r--r-- 1 root root 0 Feb 20 11:29 qemu-riscv64
-rw-r--r-- 1 root root 0 Feb 20 11:29 qemu-s390x
--w------- 1 root root 0 Feb 4 21:40 register
-rw-r--r-- 1 root root 0 Feb 4 21:40 status
[root@ningan ~]
[root@ningan ~]
/proc/sys/fs/binfmt_misc/qemu-s390x:enabled
/proc/sys/fs/binfmt_misc/qemu-arm:enabled
/proc/sys/fs/binfmt_misc/qemu-aarch64:enabled
/proc/sys/fs/binfmt_misc/qemu-mips64:enabled
/proc/sys/fs/binfmt_misc/qemu-ppc64le:enabled
/proc/sys/fs/binfmt_misc/qemu-mips64el:enabled
/proc/sys/fs/binfmt_misc/qemu-riscv64:enabled
/proc/sys/fs/binfmt_misc/jar:enabled
/proc/sys/fs/binfmt_misc/python2.7:enabled
/proc/sys/fs/binfmt_misc/llvm-6.0-runtime.binfmt:enabled
/proc/sys/fs/binfmt_misc/python3.6:enabled
grep: /proc/sys/fs/binfmt_misc/register: Invalid argument
/proc/sys/fs/binfmt_misc/status:enabled
[root@ningan ~]
docker: 'buildx' is not a docker command.
See 'docker --help'
[root@ningan ~]
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
尝试5:安装docker-buildx-plugin --> docker buildx 成功
[root@ningan ~]
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package docker-buildx-plugin
[root@ningan ~]
Hit:1 https://mirrors.aliyun.com/ubuntu bionic InRelease
Hit:2 https://mirrors.aliyun.com/ubuntu bionic-security InRelease
Hit:3 https://mirrors.aliyun.com/ubuntu bionic-updates InRelease
Hit:4 https://mirrors.aliyun.com/ubuntu bionic-backports InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
5 packages can be upgraded. Run 'apt list --upgradable' to see them.
[root@ningan ~]
OK
[root@ningan ~]
Hit:1 https://mirrors.aliyun.com/ubuntu bionic InRelease
Hit:2 https://mirrors.aliyun.com/ubuntu bionic-security InRelease
Hit:3 https://mirrors.aliyun.com/ubuntu bionic-updates InRelease
Hit:4 https://mirrors.aliyun.com/ubuntu bionic-backports InRelease
Get:5 https://download.docker.com/linux/ubuntu bionic InRelease [64.4 kB]
Get:6 https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages [39.0 kB]
Fetched 103 kB in 4s (24.2 kB/s)
Reading package lists... Done
[root@ningan ~]
Hit:1 https://mirrors.aliyun.com/ubuntu bionic InRelease
Hit:2 https://mirrors.aliyun.com/ubuntu bionic-security InRelease
Hit:3 https://mirrors.aliyun.com/ubuntu bionic-updates InRelease
Hit:4 https://download.docker.com/linux/ubuntu bionic InRelease
Hit:5 https://mirrors.aliyun.com/ubuntu bionic-backports InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
5 packages can be upgraded. Run 'apt list --upgradable' to see them.
[root@ningan ~]
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-hwe-5.4-headers-5.4.0-126 linux-hwe-5.4-headers-5.4.0-131 linux-hwe-5.4-headers-5.4.0-132 linux-hwe-5.4-headers-5.4.0-135
linux-hwe-5.4-headers-5.4.0-136 linux-hwe-5.4-headers-5.4.0-137 linux-hwe-5.4-headers-5.4.0-139 linux-hwe-5.4-headers-5.4.0-144
linux-hwe-5.4-headers-5.4.0-146 linux-hwe-5.4-headers-5.4.0-147 linux-hwe-5.4-headers-5.4.0-148 pkg-php-tools shtool
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
docker-buildx-plugin
0 upgraded, 1 newly installed, 0 to remove and 5 not upgraded.
Need to get 26.1 MB of archives.
After this operation, 71.2 MB of additional disk space will be used.
Get:1 https://download.docker.com/linux/ubuntu bionic/stable amd64 docker-buildx-plugin amd64 0.10.5-1~ubuntu.18.04~bionic [26.1 MB]
Fetched 26.1 MB in 7s (3,669 kB/s)
Selecting previously unselected package docker-buildx-plugin.
(Reading database ... 382316 files and directories currently installed.)
Preparing to unpack .../docker-buildx-plugin_0.10.5-1~ubuntu.18.04~bionic_amd64.deb ...
Unpacking docker-buildx-plugin (0.10.5-1~ubuntu.18.04~bionic) ...
Setting up docker-buildx-plugin (0.10.5-1~ubuntu.18.04~bionic) ...
[root@ningan ~]
github.com/docker/buildx v0.10.5 86bdced
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63