12
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

docker-composeの最新Verでインストール

Last updated at Posted at 2018-08-17

問題

docker-composeのインストールマニュアルには大体↓のような感じでインストールせよと書いてある。

curl -L https://github.com/docker/compose/releases/download/1.6.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose

この[1.6.2]の部分がVersionなのだが、最新がどれなのかわからず、わざわざgithubのサイトにアクセスして探さなきゃならなくて、意外と面倒だったので解決策を探していた。dockerはyumで最新版とればいいが、docker-composeだとyum使えないし、このためだけにpip installするのもめんどくさいし…。

解決策

検索したところ
https://stackoverflow.com/questions/49839028/how-to-upgrade-docker-compose-to-latest-version

にあり、ここからパクったシェル。超便利。

#!/bin/bash
compose_version=$(curl https://api.github.com/repos/docker/compose/releases/latest | jq .name -r)
output='/usr/local/bin/docker-compose'
curl -L https://github.com/docker/compose/releases/download/$compose_version/docker-compose-$(uname -s)-$(uname -m) -o $output
chmod +x $output
echo $(docker-compose --version)
12
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?