1
2

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.

Macでdevcontainerを使ってX11 Forwarding

Posted at
  1. VSCodeのextensionでRemote - Containersをinstall
  2. 画面左下を押し、Remote-Containers: Add Development Container Configuration Files...を選択
  3. どちらでもいいが今回はdocker-composeを選択
  4. .devcontainerフォルダが作成される。
  5. 中のdocker-compose.ymlに①を追記
  6. Reopen in Container
  7. Xquatsをホストにインストール
  8. Xquatsの環境設定 > セキュリティ > ネットワーク・クライアントからの接続を許可
  9. Mac再起動
  10. ホスト側で netstat -an | grep -F 6000 > 6000ポートが開いていることを確認
  11. ホスト側で xhost +localhost > localhostとの接続を許可
  12. devcontainer側でなにかGUIアプリを起動(xeyesなど)
  13. Xquatsが起動

    image: mcr.microsoft.com/vscode/devcontainers/base:focal
    environment: 
      - DISPLAY=host.docker.internal:0

host.docker.internal:0はコンテナ側から見るホストのIPで、ホスト側へとX11 Forwardingしている。

参考

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?