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

antigravity で devcontainer したいところを 助けてもらった話

0
Last updated at Posted at 2026-02-22

はじめに

  • antigravity してますか。流行ってますよね
  • devcontainerを使いたかったんですが、エラーで困ってしまったので、直してもらいました。

参考

vscode との違い

  • rebuild がない
    • めんどくさいけど、都度 docker desktop を操作して force stop + image 削除をしないといけない。
  • devcontainer で開こうとしたときに失敗すると fallback しない
    • そのため、以下の二つを Ctrl-p で実行して切り替えます
    • Local で開く 「Dev Containers: Reopen Folder Locally」
    • Container で開く 「Dev Containers: Reopen in Container」

最低限インストールが必要なもの

  • rockylinux/rockylinux:10 をベースにしたところ 最低限以下はインストールが必要でした。
    git
    which 
    wget
    procps

トラブル発生中

  • 現在、antigravity で devcontainer を開くと container内部で実行されるvscode がうまく読み込めず、エディタがエラーになります
[Error	- 15:50:15.480] forwardPort stderr: forwarder error: handleClient Error: subprocess terminated immediately with return code 127

[Error	- 15:50:16.2] forwardPort stderr: forwarder error: handleClient Error: subprocess terminated immediately with return code 127

どうしたらいい

こんなのを用意して docker compose で container 起動時に実行しておきます。

docker-compose.yml
services:
  devcontainer:
    build:
      context: ..
      dockerfile: .devcontainer/Dockerfile
    volumes:
      - ./antigravity_path_watcher.sh:/usr/local/bin/antigravity_path_watcher.sh
      - ../:/workspace
    working_dir: /workspace
    user: vscode
    command: /bin/sh -c "bash /usr/local/bin/antigravity_path_watcher.sh && sleep infinity"
    network_mode: bridge
antigravity_path_watcher.sh
#!/bin/bash

# Antigravity Remote Server binary path workaround
# This script monitors the bin directory and creates symlinks for versioned paths.
# by https://discuss.ai.google.dev/t/root-cause-identified-temporary-workaround-to-users-and-google-developers-struggling-with-devcontainer-connection-issues/121549

BIN_DIR="/home/vscode/.antigravity-server/bin"

echo "Starting Antigravity path watcher for $BIN_DIR..."

# Ensure the parent directory exists
mkdir -p "$BIN_DIR"

# Background monitoring loop
(
  while true; do
    if [ -d "$BIN_DIR" ]; then
      for dir_path in "$BIN_DIR"/*; do
        if [ -d "$dir_path" ]; then
          dir_name=$(basename "$dir_path")
          # Match [VERSION]-[HASH] pattern (e.g., 1.16.5-1504c8...)
          # Extract the hash part after the first dash
          if [[ "$dir_name" =~ ^[0-9]+\.[0-9]+\.[0-9]+-(.+)$ ]]; then
            HASH="${BASH_REMATCH[1]}"
            if [ ! -L "$BIN_DIR/$HASH" ] && [ ! -d "$BIN_DIR/$HASH" ]; then
              ln -s "$dir_name" "$BIN_DIR/$HASH"
              echo "Workaround: Created symlink $BIN_DIR/$HASH -> $dir_name"
            fi
          fi
        fi
      done
    fi
    sleep 5
  done
) &

echo "Antigravity path watcher is running in background."

おわり

このscript は workaround の投稿をそのままantigravityに張り付けて修正をお願いして生成されました。

最初にお願いしたら、修正を自分が起動しているinstanceでやろうとしていたため、devcontainerに対してだよと注釈を足す必要がありました。
人間も同じですが、何をしてほしいかちゃんと説明する必要があるので、勘違いしていると気づける程度には技術的な内容の理解が必要そうです。

ちょっとした知識は必要ですが、課題の解決に注力させると、大変強力です。

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