This minimal setup enables both Claude Code and OpenAI's Codex to run inside a Docker container. To support Shiny apps, we use the rocker/shiny-verse image. A more advanced version for general development is provided by Claude.
-
(Windows only) Install WSL2 (Windows Subsystem for Linux 2)
- Start Windows PowerShell as an Administrator. From Windows search bar, type PowerShell to find the Windows PowerShell app. And then select Run as an Administrator. For details, see here.
- Enable Windows Subsystem for Linux 2 (WSL2).
-
Install Docker Desktop. Start it and let it run in the background.
-
Install GitHub Desktop. Login.
-
Clone your project repo locally to a folder (C:\work\myproject). Create a repo for new project.
-
Install VS Code.
-
Install Dev Containers extension on VS Code
-
From GitHub Desktop, clone this repo locally to a different folder (C:\work\vibe).
-
Copy the .devcontainer folder from the vibe repo (C:\work\vibe) to your repo (C:\work\myproject). Copy the entire folder. It contains subfolders for amd64 and arm64 architectures. Each has two files. The Dockerfile defines the container image, and the devcontainer.json includes settings.
-
Start VS Code. File --> Open Folder--> (C:\work\myproject). When prompted, click "Reopen in Container". VS Code will ask you to choose between amd64 or arm64. Most people will select amd64.
Note for ARM64 users: The first build takes ~17 minutes (1050 seconds) as packages compile from source. Subsequent opens use the cached image and are fast.
-
Open a terminal in VS Code, and type in
claudeto start Claude Code. Login through the browser. I recommend create a Claude.me file first. -
Install OpenAI's Codex extension to VS Code. Login in using your ChatGPT credentials.
To update Claude Code, go to Docker Desktop. Select Containers from the left sidebar. Find the container and click on the three dots (...). Select "|> Open in Terminal". And paste this command
npm install -g @anthropic-ai/claude-code
From this terminal, you can also install R packages. To install lots of packages to the Docker image, put these R commands in a file called packages.R and saved it to project folder (C:\work\myproject). And uncomment these two lines of code in Dockerfile.
COPY ./packages.R /tmp/packages.R
RUN Rscript /tmp/packages.R
To test Shiny apps, open a new terminal in VS Code. Start R by typing R. Then select all the code in the app.R and use Ctrl+Enter. When prompted, click on the link such as http://127.0.0.1:6778/, which is open in a web browser.