4
3

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 3 years have passed since last update.

CoreOSなどに latest な docker-compose を入れるスクリプト

Last updated at Posted at 2018-09-09

2019/01/30 追記
/opt/bin ディレクトリが無いみたいなので、作るように修正しました。

=======

結果

最終的には、これ

COMPOSE_VERSION=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep 'tag_name' | cut -d\" -f4)
OUTPUT_PATH="/opt/bin"
sudo mkdir -p ${OUTPUT_PATH}
sudo curl -L "https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o ${OUTPUT_PATH}/docker-compose
sudo chmod +x ${OUTPUT_PATH}/docker-compose
docker-compose -v

CoreOS以外、curlが無いやつでも使えるように、wget版↓

COMPOSE_VERSION=$(wget -q https://api.github.com/repos/docker/compose/releases/latest -O - | grep 'tag_name' | cut -d\" -f4)
OUTPUT_PATH="/opt/bin"
sudo mkdir -p /opt/bin
sudo wget -L -q "https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -O ${OUTPUT_PATH}/docker-compose
sudo chmod +x ${OUTPUT_PATH}/docker-compose
docker-compose -v

バージョンが表示されたらオッケー

経緯

docker-compose の公式にも特定バージョンを指定した curl しか載ってなかった・・・
latest を追い求める自分()としてはイケテナイです

curl する url を洗い出す

https://gist.github.com/deviantony/2b5078fe1675a5fedabf1de3d1f2652a
ここを参考にしました

↓引用

COMPOSE_VERSION=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep 'tag_name' | cut -d\" -f4)

githubのlatestページからtag_nameをgrepして、tag情報だけ切りきり...
なるへそ

配置場所を決める

echo $PATH してみる

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/opt/bin

/usr 配下は ReadOnly みたい・・・
/opt/bin に決定

4
3
1

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
4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?