如何将docker-compose升级到最新版本 [英] How to upgrade docker-compose to latest version
问题描述
我已经使用命令安装了docker-compose
I have installed docker-compose using the command
sudo apt install docker-compose
它安装了docker-compose版本1.8.0并构建了未知版本
It installed docker-compose version 1.8.0 and build unknown
我需要最新版本的docker-compose或至少版本1.9.0
I need the latest version of docker-compose or at least a version of 1.9.0
任何人都可以让我知道升级或卸载并重新安装最新版本时应该采用的方法。
Can anyone please let me know what approach I should take to upgrade it or uninstall and re-install the latest version.
我已经检查了docker网站,可以看到他们建议安装最新版本'
I have checked the docker website and can see that they are recommending this to install the latest version'
sudo curl -L https://github.com/docker/compose/releases/download/1.21.0/docker-compose-$(uname -s)-$(uname -m)-o / usr / local / bin / docker-compose
但是在此之前,我必须卸载当前版本,可以使用命令
But before that, I have to uninstall the present version, which can be done using the command
sudo rm / usr / local / bin / docker-compose
但这仅在使用curl完成安装时可用。我不确定是否已使用我的
but this can be used only when the installation was done using curl. I am not sure if the installation was done by curl as I have used
sudo apt install docker-compose
请让我知道我现在应该怎么做才能卸载并重新安装docker-compose。
Please let me know what should I do now to uninstall and re-install the docker-compose.
推荐答案
首先,删除旧版本:
如果通过 apt-get 安装>
sudo apt-get remove docker-compose
如果通过 curl
sudo rm /usr/local/bin/docker-compose
如果通过 pip 安装
pip uninstall docker-compose
然后在 GitHub上的发布页面上找到最新版本 或通过卷曲API(如果已安装 jq
)(感谢 dragon788 和 frbl 进行此改进):
Then find the newest version on the release page at GitHub or by curling the API if you have jq
installed (thanks to dragon788 and frbl for this improvement):
VERSION=$(curl --silent https://api.github.com/repos/docker/compose/releases/latest | jq .name -r)
最后, download 到您喜欢的$ PATH -可访问的位置并设置权限:
Finally, download to your favorite $PATH-accessible location and set permissions:
DESTINATION=/usr/local/bin/docker-compose
sudo curl -L https://github.com/docker/compose/releases/download/${VERSION}/docker-compose-$(uname -s)-$(uname -m) -o $DESTINATION
sudo chmod 755 $DESTINATION
这篇关于如何将docker-compose升级到最新版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!