【docker错误解决系列】 ‘buildx‘ is not a docker command.

文章目录

  • 问题
  • 环境
  • 解决办法
    • 尝试1:修改~/.docker /config.json
    • 尝试2:exporter DOCKER_CLI_EXPERIMENTAL=enabled
    • 尝试3:修改/etc/docker/daemon.json --> Experimental成功开启
    • 尝试4:开启binfmt
    • 尝试5:安装docker-buildx-plugin --> docker buildx 成功

问题

[root@ningan ~]# docker buildx
docker: 'buildx' is not a docker command.
See 'docker --help'

环境

[root@ningan ~]# uname -a
Linux ningan 5.4.0-150-generic #167~18.04.1-Ubuntu SMP Wed May 24 00:51:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
[root@ningan ~]# docker version
Client:Version:           20.10.21API version:       1.41Go version:        go1.18.1Git commit:        20.10.21-0ubuntu1~18.04.3Built:             Thu Apr 27 05:50:21 2023OS/Arch:           linux/amd64Context:           defaultExperimental:      trueServer:Engine:Version:          20.10.21API version:      1.41 (minimum version 1.12)Go version:       go1.18.1Git commit:       20.10.21-0ubuntu1~18.04.3Built:            Thu Apr 27 05:36:22 2023OS/Arch:          linux/amd64Experimental:     falsecontainerd:Version:          v1.6.2GitCommit:        de8046a5501db9e0e478e1c10cbcfb21af4c6b2drunc:Version:          1.1.1GitCommit:        v1.1.0-20-g52de29d7docker-init:Version:          0.19.0GitCommit:        
[root@ningan ~]# 

解决办法

尝试1:修改~/.docker /config.json

[root@ningan ~]# mkdir ~/.docker 
mkdir: cannot create directory ‘/root/.docker’: File exists
[root@ningan ~]# cd .docker/
[root@ningan .docker]# ll
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 ~]# vi config.json
{..."experimental": "enabled"
}
[root@ningan .docker]# docker buildx version
docker: 'buildx' is not a docker command.
See 'docker --help'
[root@ningan .docker]# docker version
Client:Version:           20.10.21API version:       1.41Go version:        go1.18.1Git commit:        20.10.21-0ubuntu1~18.04.3Built:             Thu Apr 27 05:50:21 2023OS/Arch:           linux/amd64Context:           defaultExperimental:      trueServer:Engine:Version:          20.10.21API version:      1.41 (minimum version 1.12)Go version:       go1.18.1Git commit:       20.10.21-0ubuntu1~18.04.3Built:            Thu Apr 27 05:36:22 2023OS/Arch:          linux/amd64Experimental:     falsecontainerd:Version:          v1.6.2GitCommit:        de8046a5501db9e0e478e1c10cbcfb21af4c6b2drunc:Version:          1.1.1GitCommit:        v1.1.0-20-g52de29d7docker-init:Version:          0.19.0GitCommit:        

尝试2:exporter DOCKER_CLI_EXPERIMENTAL=enabled

[root@ningan .docker]# export DOCKER_CLI_EXPERIMENTAL=enabled
[root@ningan .docker]# 
[root@ningan .docker]# docker buildx version
docker: 'buildx' is not a docker command.
See 'docker --help'
[root@ningan .docker]# docker version
Client:Version:           20.10.21API version:       1.41Go version:        go1.18.1Git commit:        20.10.21-0ubuntu1~18.04.3Built:             Thu Apr 27 05:50:21 2023OS/Arch:           linux/amd64Context:           defaultExperimental:      trueServer:Engine:Version:          20.10.21API version:      1.41 (minimum version 1.12)Go version:       go1.18.1Git commit:       20.10.21-0ubuntu1~18.04.3Built:            Thu Apr 27 05:36:22 2023OS/Arch:          linux/amd64Experimental:     falsecontainerd:Version:          v1.6.2GitCommit:        de8046a5501db9e0e478e1c10cbcfb21af4c6b2drunc:Version:          1.1.1GitCommit:        v1.1.0-20-g52de29d7docker-init:Version:          0.19.0GitCommit:   
[root@ningan .docker]# docker info |grep Experimental
WARNING: No swap limit supportExperimental: false     

尝试3:修改/etc/docker/daemon.json --> Experimental成功开启

[root@ningan .docker]# vi /etc/docker/daemon.json
{"experimental": true,...
}
[root@ningan .docker]# systemctl restart docker
[root@ningan .docker]# docker info |grep Experimental
WARNING: No swap limit supportExperimental: true
[root@ningan ~]# docker version
Client:Version:           20.10.21API version:       1.41Go version:        go1.18.1Git commit:        20.10.21-0ubuntu1~18.04.3Built:             Thu Apr 27 05:50:21 2023OS/Arch:           linux/amd64Context:           defaultExperimental:      trueServer:Engine:Version:          20.10.21API version:      1.41 (minimum version 1.12)Go version:       go1.18.1Git commit:       20.10.21-0ubuntu1~18.04.3Built:            Thu Apr 27 05:36:22 2023OS/Arch:          linux/amd64Experimental:     true                      ###########################  这个地方变成true了containerd:Version:          v1.6.2GitCommit:        de8046a5501db9e0e478e1c10cbcfb21af4c6b2drunc:Version:          1.1.1GitCommit:        v1.1.0-20-g52de29d7docker-init:Version:          0.19.0GitCommit:  
[root@ningan ~]# docker buildx version
docker: 'buildx' is not a docker command.
See 'docker --help      

尝试4:开启binfmt

[root@ningan ~]# docker run --rm --privileged tonistiigi/binfmt:latest --install all
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 ~]# ls -l /proc/sys/fs/binfmt_misc/
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 ~]# grep -r "enabled" /proc/sys/fs/binfmt_misc/ 
/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
docker: 'buildx' is not a docker command.
See 'docker --help'
[root@ningan ~]# 

尝试5:安装docker-buildx-plugin --> docker buildx 成功

[root@ningan ~]# sudo apt install docker-buildx-plugin
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package docker-buildx-plugin
[root@ningan ~]# apt update
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.# 添加 Docker 官方 GPG 密钥:
[root@ningan ~]# curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
OK
# 添加 Docker 官方仓库:
[root@ningan ~]# sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
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# 更新软件源列表并安装 `docker-buildx-plugin`
[root@ningan ~]# sudo apt update  
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 ~]# sudo apt install docker-buildx-plugin
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-135linux-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-144linux-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 ~]# docker buildx version
github.com/docker/buildx v0.10.5 86bdced

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/693319.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

智能风控体系之逻辑回归

逻辑回归就是这样的一个过程:面对一个回归或者分类问题,建立代价函数,然后通过优化方法迭代求解出最优的模型参数,然后测试验证我们这个求解的模型的好坏。在信贷风控领域最常用的广义线性模型就是逻辑回归。其实逻辑回归线性可分…

Jetpack Compose 与 Kotlin 的兼容性对应关系

点击查看:Jetpack Compose Kotlin 的兼容性 官网 声明依赖项 如需添加 Compose Compiler 的依赖项,您必须将 Google Maven 代码库添加到项目中。如需了解详情,请参阅 Google 的 Maven 代码库。 在应用或模块的 build.gradle或者build.grad…

【报错】npm ERR! ERESOLVE could not resolve、certificate has expired

前情提要 使用npm淘宝镜像 https://registry.npm.taobao.org 年前创建的vue3项目npm install 完后没有使用ui写了点杂七杂八的东西,年后看到一篇文章有点兴趣,掏出来准备试一下,本打算安装element-plus 写起来方便点npm install element-plu…

说一下JVM类加载机制?

Java中的所有类,都需要由类加载器装载到JVM中才能运行。类加载器本身也是一个类,而它的工作就是把class文件从硬盘读取到内存中。 在写程序的时候,我们几乎不需要关心类的加载,因为这些都是隐式装载的,除非我们有特殊…

pc微信逆向最新3.9.8.25版本

朋友让我开发一个关于微信的计数、统计、自动回复功能的机器人,主要是用在win10上面。 先看看结果! 之前写过手机端的逆向,PC端逆向很长时间没写了,所以就在网上找了找。基本都是基于3.6,3.7,3.8版本的&a…

虹科方案 | 释放总线潜力:汽车总线离线模拟解决方案

来源:虹科汽车智能互联 虹科方案 | 释放总线潜力:汽车总线离线模拟解决方案 原文链接:https://mp.weixin.qq.com/s/KGv2ZOuQMLIXlOiivvY6aQ 欢迎关注虹科,为您提供最新资讯! #汽车总线 #ECU #汽车网关 导读 传统的…

长短期记忆神经网络

目录 LSTM 神经网络架构 分类 LSTM 网络 回归 LSTM 网络 视频分类网络 更深的 LSTM 网络 网络层 分类、预测和预报 序列填充、截断和拆分 按长度对序列排序 填充序列 截断序列 拆分序列 指定填充方向 归一化序列数据 无法放入内存的数据 可视化 LSTM 层架构 …

Find My资讯|苹果Vision Pro无法通过Find My进行远程定位和发声

苹果 Vision Pro 头显现在已经正式开售,不过根据该公司日前发布的支持文件,这款头显目前缺乏一系列关键查找功能,用户无法在 iCloud 网站或Find My应用中获悉头显的位置,也无法让这款头显远程播放声音。 不过支持文件同时提到 V…

DAY57:动态规划(子序列2)1143、1035、53

Leetcode: 1143 最长公共子序列 1、dp数组定义和下标 dp[i][j]:长度为[0, i - 1]的字符串text1与长度为[0, j - 1]的字符串text2的最长公共子序列。 2、确认递推公式 如果text1[i - 1] 与 text2[j - 1]相同,那么找到了一个公共元素,所以d…

Android 开机启动

一、添加权限 <uses-permission android:name"android.permission.RECEIVE_BOOT_COMPLETED"/> 二、写一个广播接收器 public class BootReceiver extends BroadcastReceiver {Overridepublic void onReceive(Context context, Intent intent) {if(Intent.ACT…

数学物理方法笔记——Γ函数

Γ \Gamma Γ函数 0.前言 本文是吴崇试的《数学物理方法》第七章学习笔记。今天是数学物理方法Ⅱ上课的第一天&#xff0c;老师在课上简单复习了一下上个学期数学物理方法I的内容&#xff0c;笔者闲着没事&#xff0c;总觉得梁昆淼先生的书不太够味儿&#xff0c;便开始翻弄起…

【机器学习】数据清洗之处理重复点

&#x1f388;个人主页&#xff1a;豌豆射手^ &#x1f389;欢迎 &#x1f44d;点赞✍评论⭐收藏 &#x1f917;收录专栏&#xff1a;机器学习 &#x1f91d;希望本文对您有所裨益&#xff0c;如有不足之处&#xff0c;欢迎在评论区提出指正&#xff0c;让我们共同学习、交流进…

【栈】150. 逆波兰表达式求值

150. 逆波兰表达式求值 解题思路 初始化栈&#xff1a; 创建一个整数栈用于存储操作数。 遍历表达式数组&#xff1a; 对于数组中的每个元素&#xff1a; 如果是运算符&#xff0c;从栈中弹出两个操作数&#xff0c;并根据运算符进行相应的运算&#xff0c;然后将结果压入栈…

C++(18)——适配器概念以及stack、queue、优先队列的模拟实现

上篇文章中&#xff0c;给出了对于模拟实现中功能的补全&#xff0c;本篇文章将优先介绍一个新的容器之后引入什么是适配器&#xff0c;以及适配器的使用方法&#xff0c;再通过适配器的思想来完成对于&#xff0c;、优先级队列_的实现。 目录 1. deque: 1.1 什么是deque&…

导出docker MySQL中的数据库写一个shell 脚本

安装命令 mysqldump sudo apt update sudo apt install mysql-client编辑脚本内容 export_mysql.sh #!/bin/bash# Docker 容器的 IP 地址 container_ip"172.26.77.246"# MySQL 数据库的用户名和密码 mysql_user"root" mysql_password"your_password…

Android studio 安装以及第一个程序

一、配置 1、下载JDK&#xff08;JDK&#xff1a;Java Development Kit Java开发工具包&#xff09; 打开Java Downloads | Oracle下载地址下载相应的JDK版本即可&#xff0c;需要注意的是请下载JDK11以上的版本&#xff0c;并且是64位版 2、安装JDK 双击打开已经下载好的安装…

Query Rewrite —— 基于大模型的query扩展改写,PRF+ GRF协同发力减少LLM的幻觉问题(论文)

通过GRF和PRF&#xff0c;可以有效提升召回率&#xff0c;和top的数据质量。两者可以相互互补&#xff0c;发挥更好的作用。 论文&#xff1a;Generative and Pseudo-Relevant Feedback for Sparse, Dense and Learned Sparse Retrieval 什么是PRF &#xff1f; Pseudo-relevan…

python在flask中的请求数据“无限流”

文章目录 一、问题描述二、解决方案 一、问题描述 在flask请求中&#xff0c;有个需求是让调用方一直调接口&#xff0c;并立马返回&#xff0c;而接口方缓存请求&#xff0c;依次执行。 二、解决方案 from flask import Flask, request, jsonify from queue import Queue i…

新年伊始,VR全景释放“强信号”,可以结合哪些行业?

一年之计在于春&#xff0c;各行各业都想抢占在经济的第一线&#xff0c;那么如何抓住新一轮科技革命和产业变革新机遇呢&#xff1f;VR全景释放了“强信号”。对于大部分实体行业来说&#xff0c;都会有VR全景的制作需求&#xff0c;租房买房的&#xff0c;可能都见识过线上VR…

【JGit】分支管理实践

本文紧接【JGit】简述及学习资料整理。 以下梳理了使用 JGit 进行 Git 操作的实践 JGit实践 主函数 public static void main(String[] args) throws Exception {String localDir "D:\\tmp\\git-test\\";String gitUrl "http://192.168.181.1:3000/root/g…