docker composeのバージョンアップ方法
docker compose コマンド時のエラー
以下のエラーが表示される場合、.ymlファイルのバージョンとdocker-composeのバージョンが乖離していることが原因である。
ERROR: Version in "./docker-compose.yml" is unsupported. You might be seeing this error because you're using the wrong Compose file version. Either specify a supported version (e.g "2.2" or "3.3") and place your service definitions under the `services` key, or omit the `version` key and place your service definitions at the root of the file to use version 1. For more on the Compose file format versions, see https://docs.docker.com/compose/compose-file/
docker compose のアップグレード方法
そのため現バージョンが1系であれば、以下のコマンドを実行し、.ymlファイルと対応したバージョンのdocker-composeをインストールする。
現docker-composeのアンインストール
sudo apt remove docker-compose
新バージョンのインストール (2行目: v?.?.?の部分はリリースノートを参照し適宜変更する)
https://github.com/docker/compose/releases/
mkdir -p $HOME/.docker/cli-plugins curl -Lf -o $HOME/.docker/cli-plugins/docker-compose "https://github.com/docker/compose/releases/download/v?.?.?/docker-compose-linux-x86_64" chmod +x $HOME/.docker/cli-plugins/docker-compose