Loading

解决docker-compose 命令不存在、未找到命令错误

安装扩展源:

sudo yum -y install epel-release

安装python-pip模块:

sudo yum install python-pip

查看docker-compose版本,提示未找到命令:

docker-compose version

image.png

通过命令进行安装:

进入目录: cd /usr/local/bin/
wget https://github.com/docker/compose/releases/download/1.14.0-rc2/docker-compose-Linux-x86_64
rename docker-compose-Linux-x86_64 docker-compose
chmod +x /usr/local/bin/docker-compose

docker-compose version命令进行查看:

image.png

后面会出现docker-compose的版本太低的情况:

首先

运行以下命令,下载Docker Compose的当前稳定版本

mkdir -p /usr/local/bin/docker/cli-plugins
$ curl -SL https://github.com/docker/compose/releases/download/v2.2.2/docker-compose-linux-x86_64 -o /usr/local/bin/docker/cli-plugins/docker-compose

或者可以从下面页下载稳定版 docker-compose-linux-x86_64

https://github.com/docker/compose/releases

上传到 /usr/local/bin/docker/cli-plugins/ 目录下 并且修改 docker-compose-linux-x86_64 文件名为 docker-compose

对二进制文件应用可执行权限

chmod +x /usr/local/bin/docker/cli-plugins/docker-compose

测试安装

docker compose version


 显示版本为  Docker Compose version v2.2.2

posted @ 2022-08-28 18:15  LiJialong  阅读(7084)  评论(0编辑  收藏  举报