2
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 1 year has passed since last update.

M1 Macで intel系コンテナをdevcontainer.jsonで起動する

Posted at

devcontainer.jsonは便利

開発環境をコンテナ化しているのですが、VSCodeをdevcontainerを使ってより加速してきた感じがあります。
ただ、Applie SiliconのMacはCPUがArm系なのでデフォルトだとArmのイメージを使用します。

Rosetta2

M1 移行期はいろいろできないこともありましたし、いまではRosetta2を使わないでコンテナを動かせればいいのですが、それでもコンテナのビルド環境によってはプラットフォーム依存になっていることが多いので、どうしてもx86_64を使わないとねということもあります。

前提

  • Rosetta2を(諦めて)インストールする
  • Docker Desktopもインストールする
  • VSCode

devcontainer.json

以下の情報を追加します。

"runArgs": ["--platform=linux/amd64"],

確認方法

VSCodeから開発コンテナーで起動し、Docker DesktopのContainersでAMD64 の情報が出ていればOKです。
Containers_-_Docker_Desktop.png
表示されない場合は、VSCodeでコンテナーのリビルドをします。

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