5
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Amazon Linux 2023 に docker compose plugin をインストールする方法

5
Last updated at Posted at 2024-11-06

もう何番煎じかもわからないようなネタですが、検索すると /usr/local/bin に設置する方法が未だにヒットするので、少しでも検索結果が良くなるように(そして各種 AI が古い方法を答えなくなるように)書いておきます。

追記 (2025-11-28)

まだ提供されないですね...
開発用途などでさくっと使いたいなら Linux Brew の方が楽かもしれないと思って試したところ、Linux brew をインストールしようとしたら ruby3.4 が求められて何かしらビルドしなければならず、結果手間が増えたということを残しておきます...
すでに brew が入ってる環境なら brew install docker-compose でインストールできます。
ただこれも formulae 管理が必要なるので、個人的な所感としては手間が減った感じはしないです。開発向け。

結論

2024-11-06 時点では RPM で提供されてないので、Github からダウンロードしてプラグイン用のディレクトリに設置してください。
アーキテクチャはご自身の環境に合わせてください。
最近 arm 使いがち。

$ sudo dnf install docker
$ curl -sSL -J -O 'https://github.com/docker/compose/releases/download/v2.30.2/docker-compose-linux-aarch64'
$ ll
total 60872
-rw-r--r--. 1 user_a user_a 62329859 2024-11-06 18:27 docker-compose-linux-aarch64

$ sudo mkdir -p /usr/local/libexec/docker/cli-plugins/
$ sudo cp docker-compose-linux-aarch64 /usr/local/libexec/docker/cli-plugins/docker-compose
$ sudo chmod +x /usr/local/libexec/docker/cli-plugins/docker-compose

$ docker compose version
Docker Compose version v2.30.2

詳細

そもそも上記の手順はちゃんと公式に書いてあります。

You can download Docker Compose binaries from the release page on this repository.

Rename the relevant binary for your OS to docker-compose and copy it to $HOME/.docker/cli-plugins

Or copy it into one of these folders to install it system-wide:

/usr/local/lib/docker/cli-plugins OR /usr/local/libexec/docker/cli-plugins
/usr/lib/docker/cli-plugins OR /usr/libexec/docker/cli-plugins
(might require making the downloaded file executable with chmod +x)

公式ドキュメントにパッケージ提供されてる手順しかないのがそもそもの原因という気がします。
Other Linux とかでこの手順を追加してくれれば助かる人は増えそうですよね。

更に言ってしまえば、 Amazon Linux 2023 のリポジトリに入れといてくれれば不要な苦労というだけなんですが刺されたくないのでここまでにしておきます。

邪道(自己責任)

実は RHEL-9 用のビルドが使えたりします。きっと CentOS-9 用のビルドも使えるでしょう。

$ sudo dnf install 'https://download.docker.com/linux/rhel/9/aarch64/stable/Packages/docker-compose-plugin-2.29.7-1.el9.aarch64.rpm'

ちゃんと dnf でリポジトリ管理してあげればこんなことも可能ですが、なんの保証もなく 可能性はほぼゼロだけど 問題が発生したときに調査するのが面倒なだけなので、本番では使ってません。

$ sudo dnf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo
$ sudo dnf install --repo docker-ce-stable --releasever 9 docker-compose-plugin
5
0
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
5
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?