Last active
May 25, 2023 09:58
-
-
Save eplord/e3a98b7a7810da24ab011e0c642a6e1b to your computer and use it in GitHub Desktop.
Install/Uninstall Docker Compose Stand-Alone Binary Linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Install/Uninstall Latest Docker Compose Stand-Alone Binary Linux | |
| # Tested on Ubuntu 22.04 | |
| version="" | |
| latest="$(curl --silent "https://api.github.com/repos/docker/compose/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")' )" | |
| _version=${version:-$latest} | |
| _install() { | |
| if ! [ -x "$(command -v docker-compose)" ]; then | |
| sudo curl -L https://github.com/docker/compose/releases/download/${_version}/docker-compose-$(uname -s)-$(uname -m) \ | |
| -o /usr/local/bin/docker-compose && sudo chmod +x /usr/local/bin/docker-compose | |
| fi | |
| } | |
| _uninstall() { | |
| sudo rm -rf /usr/local/bin/docker-compose | |
| } | |
| _sub=${1:-install} | |
| case "$_sub" in | |
| install) | |
| _install | |
| ;; | |
| uninstall) | |
| _uninstall | |
| ;; | |
| exit) | |
| exit 1 | |
| esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment