0
1

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.

docker-compose普通の環境設定2022「Mac darwin aarch64 M1」

Last updated at Posted at 2022-03-21

環境

Mac M1チップ
Docker入ってる前提
 入ってない人はここから入れてください。定期的にアップデートしないと動かなくなったりします。
 https://docs.docker.com/desktop/mac/install/

docker-composeのバージョンを選ぶ

Composeファイル形式のバージョンは書き換えればいいけど、結局どれをインストールすればいいのってのがあります。

下記でいうところのv2.2.2の部分です。最新を選ぶなら最新をとってください。
過去のを取る場合は今お使いのDocker Engineのリリースの時期にちかいtagを見つけてダウンロードしてください。

公式gitからどれをインストールするか選んでください。
スクリーンショット 2022-03-21 14.30.45.png

https://github.com/docker/compose/releases
mac以外の人はdarwinのところをlinuxとか変えれば動くと思います。

curl -Lo docker-compose https://github.com/docker/compose/releases/download/v2.2.2/docker-compose-darwin-aarch64
mv docker-compose /usr/local/bin/

Composeファイル形式

あまりインストールに関係ないですがcomposerファイルには初めにversionってのが書いてます。
多分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 ("2.0", "2.1", "3.0") 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/

下記の例では3.9になってますね。
バージョンが足りない時はdocker-composeを更新してみてください。

docker-compose.yml
version: '3.9'

services:
  mysql:
    build:
      context: .
      dockerfile: docker/mysql/Dockerfile

スクリーンショット 2022-03-21 14.13.58.png

最新情報は下記を参考

それでは良いエンジニアライフを!

フォローして意見とか雑談とかで絡んでもらえると喜びます。
https://twitter.com/miyamotok0105

0
1
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?