Skip to content

Add Docker container setup for running Claude Code safely - #4139

Merged
maliberty merged 2 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:claude-docker
Apr 13, 2026
Merged

maliberty merged 2 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:claude-docker

Conversation

@openroad-ci

Copy link
Copy Markdown
Member

Provides claude.sh wrapper and Docker image that sandboxes claude --dangerously-skip-permissions inside a container with CMake, Bazel, and ORFS support. The repo is volume-mounted so edits persist on the host with correct UID/GID ownership.

@maliberty
maliberty requested a review from jhkim-pii April 12, 2026 22:58
@maliberty

Copy link
Copy Markdown
Member

@gemini-code-assist /review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a Docker-based environment for running Claude Code, including a wrapper script, a Dockerfile, and an entrypoint script to handle UID/GID mapping. The feedback identifies critical issues regarding the VS Code CLI architecture compatibility, potential shell script failures when handling multiple users with the same UID, and a mismatch between volume mounts and home directory paths. Additionally, there is a suggestion to refactor duplicated environment sourcing logic.

Comment thread docker/Dockerfile.claude Resolved
Comment thread docker/claude-entrypoint.sh Resolved
Comment thread docker/claude-entrypoint.sh Resolved

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a Docker-based environment for running Claude Code within the OpenROAD flow, providing a sandboxed workspace with access to build tools like CMake and Bazel. Key components include a wrapper script for container management, a Dockerfile extending the OpenROAD dev image, and an entrypoint script for user permission mapping. Feedback focuses on fixing a Bash substitution error in the wrapper script, correcting the VS Code CLI download URL to match the Ubuntu base image, and improving debuggability by allowing errors to propagate when sourcing the environment configuration.

Comment thread claude.sh Resolved
Comment thread docker/Dockerfile.claude Resolved
Comment thread docker/claude-entrypoint.sh Resolved
Comment thread docker/claude-entrypoint.sh Resolved
Provides claude.sh wrapper and Docker image that sandboxes
claude --dangerously-skip-permissions inside a container with
CMake, Bazel, and ORFS support. The repo is volume-mounted so
edits persist on the host with correct UID/GID ownership.

Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
@jhkim-pii

Copy link
Copy Markdown
Collaborator

I tested this PR locally, but it failed.
The URL https://code.visualstudio.com/sha/download?build=stable&os=cli-linux-x64 is not found.

/workspace/ws9/OpenROAD-flow-scripts $ ./claude.sh 
Image openroad/flow-claude:latest not found. Building automatically...
Building Claude Code Docker image: openroad/flow-claude:latest
[+] Building 2.0s (11/15)                                                   docker:default
 => [internal] load build definition from Dockerfile.claude                           0.0s
 => => transferring dockerfile: 1.93kB                                                0.0s
 => [internal] load metadata for docker.io/openroad/flow-ubuntu22.04-dev:latest       0.0s
 => [internal] load .dockerignore                                                     0.0s
 => => transferring context: 2B                                                       0.0s
 => [ 1/11] FROM docker.io/openroad/flow-ubuntu22.04-dev:latest                       0.0s
 => [internal] load build context                                                     0.0s
 => => transferring context: 1.96kB                                                   0.0s
 => CACHED [ 2/11] RUN apt-get update     && apt-get install -y --no-install-recomme  0.0s
 => CACHED [ 3/11] RUN curl -Lo /usr/local/bin/bazelisk         https://github.com/b  0.0s
 => CACHED [ 4/11] RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash -      0.0s
 => CACHED [ 5/11] RUN npm install -g @anthropic-ai/claude-code                       0.0s
 => CACHED [ 6/11] RUN apt-get update     && apt-get install -y --no-install-recomme  0.0s
 => ERROR [ 7/11] RUN curl -fsSL "https://code.visualstudio.com/sha/download?build=s  1.3s
------                                                                                     
 > [ 7/11] RUN curl -fsSL "https://code.visualstudio.com/sha/download?build=stable&os=cli-linux-x64"         -o /tmp/vscode-cli.tar.gz     && tar -xzf /tmp/vscode-cli.tar.gz -C /usr/local/bin     && rm /tmp/vscode-cli.tar.gz:
0.934 curl: (22) The requested URL returned error: 404
------
Dockerfile.claude:44
--------------------
  43 |     # VS Code CLI (code-tunnel for remote editing)
  44 | >>> RUN curl -fsSL "https://code.visualstudio.com/sha/download?build=stable&os=cli-linux-x64" \
  45 | >>>         -o /tmp/vscode-cli.tar.gz \
  46 | >>>     && tar -xzf /tmp/vscode-cli.tar.gz -C /usr/local/bin \
  47 | >>>     && rm /tmp/vscode-cli.tar.gz
  48 |     
--------------------
ERROR: failed to build: failed to solve: process "/bin/sh -c curl -fsSL \"https://code.visualstudio.com/sha/download?build=stable&os=cli-linux-x64\"         -o /tmp/vscode-cli.tar.gz     && tar -xzf /tmp/vscode-cli.tar.gz -C /usr/local/bin     && rm /tmp/vscode-cli.tar.gz" did not complete successfully: exit code: 22

@jhkim-pii

Copy link
Copy Markdown
Collaborator

If I change the URL to https://update.code.visualstudio.com/latest/cli-linux-x64/stable, it works. Claude is launched successfully.

Comment thread claude.sh Outdated

# --- Assemble docker run arguments ---
DOCKER_RUN_ARGS=(
--rm -it

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Giving -it always prevents non-interactive use case (e.g., inline prompting to Claude in CI env).

This looks slightly better.

DOCKER_RUN_ARGS=(
    --rm                     // REMOVE -it
    --name "${CONTAINER_NAME}"
    ...
)
if [[ -t 0 && -t 1 ]]; then
    DOCKER_RUN_ARGS+=(-it)        // ADD -it IF TERMINAL IS PRESENT
fi

@maliberty

maliberty commented Apr 13, 2026 •

Copy link
Copy Markdown
Member

claude picked alpine and gemini suggested a better solution but hallucinated the endpoint. When I gave claude the gemini feedback it accepted it. I already had a cached image so I didn't notice.

The cli-linux-x64 identifier on code.visualstudio.com/sha/download
returns 404; use update.code.visualstudio.com/latest/cli-linux-x64/stable,
which delivers the glibc-linked binary that matches the Ubuntu base.

Also stop forcing -it unconditionally, which broke CI-style invocations
with "cannot attach stdin to a TTY-enabled container". Allocate a TTY
only when both stdin and stdout are terminals; otherwise pass -i so
piped input still reaches the container.

Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
@maliberty
maliberty requested a review from jhkim-pii April 13, 2026 15:40
@maliberty
maliberty merged commit bdad3eb into The-OpenROAD-Project:master Apr 13, 2026
5 checks passed
@maliberty
maliberty deleted the claude-docker branch April 13, 2026 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants