2
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?

More than 1 year has passed since last update.

Docker Compose V1 が deprecated となり、Docker Compose V2 が推奨となる様子

Posted at

Docker Compose V1 が deprecated となり、Docker Compose V2 が推奨となる様子
(最近気付いた)

[Docker Compose] V1 End of Life Policy #257
April 2023 - 1 Year Post GA
Users can alias docker-compose to docker compose
Users can no longer opt-out of V2 via the Docker Desktop UI or through the docker-compose disable-v2 command in new versions

以下の記事がわかりやすかった

Docker Compose V2(Version 2) GA のまとめ

Docker Compose V2 は公式手順からインストールできる

https://docs.docker.com/engine/install/ubuntu/

sudo apt-get update
sudo apt-get install ca-certificates curl gnupg lsb-release
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin

もし上記でインストール失敗した場合は以下の先人の記事を参照すればよさそう

Where to get Docker Compose
Ubuntu20.04へのDocker Compose v2 インストール

/usr/local/libexec/docker/cli-pluginsにインストールする場合
# インストール先ディレクトリがなければつくる。説明を楽にするためにカレントディレクトリも変更
sudo mkdir -p /usr/local/libexec/docker/cli-plugins
cd /usr/local/libexec/docker/cli-plugins

# リリースモジュールをダウンロードし、docker-composeという名前でインストール先に保存
sudo curl -L https://github.com/docker/compose/releases/download/v2.6.1/docker-compose-linux-x86_64 -o docker-compose
# docker-composeを実行可能にする
sudo chmod +x docker-compose
動作確認
$ docker compose version
Docker Compose version v2.6.1

docker compose switch (Compose V1をCompose V2に変換してくれるコマンド)

https://github.com/docker/compose-switch/
Compose Switch
Compose Switch is a replacement to the Compose V1 docker-compose (python) executable. It translates the command line into Compose V2 docker compose then run the latter.

2
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
2
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?