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?

コンテナ内のClineのブラウザが動かない!

Posted at

環境

  • devcontainerを使用
  • Docker image:python:3.9
  • cline:3.15.5

症状

clineに何らかのwebサイトへのアクセスを依頼して,clineがbrowser_actionを実行しようとしたところ,エラーが出てブラウザを実行できない.
(具体的なエラーメッセージは忘れましたが,依存パッケージの不足とそれらを解決した後のrootではできないよ!というエラーでした.)

対処法

devcontainerを使っており,かつパッケージマネージャーがaptである場合の説明です.

エラーの原因になっている依存パッケージをインストールします.

devcontainer.json

devcontainer.json
    "features": {
        "ghcr.io/rocker-org/devcontainer-features/apt-packages:1": {
            "packages": [
                "sudo",
                "libnss3",
                "libdbus-1-3",
                "libatk1.0-0",
                "libatk-bridge2.0-0",
                "libcups2",
                "libxkbcommon0",
                "libxcomposite1",
                "libxdamage1",
                "libxfixes3",
                "libxrandr2",
                "libgbm1",
                "libasound2"
            ]
        }
    }

devcontainerをnon-root userで実行するようにします.

devcontainer.json

devcontainer.json
    "remoteUser": "vscode"

Dockerfile

ARG username=vscode
ARG useruid=1000
ARG usergid=${useruid}

RUN groupadd --gid ${usergid} ${username} && \
    useradd -s /bin/bash --uid ${useruid} --gid ${usergid} -m ${username} && \
    mkdir /etc/sudoers.d && \
    echo ${username} ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/${username} && \
    chmod 0440 /etc/sudoers.d/${username} && \
    chown -R ${username}:${username} /home/${username}

USER ${username}

参考

VSCode Devcontainer 放浪記
Steps to run browser in .devcontainer · Issue #2095 · cline/cline

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?