This is my minimal devcontainer for playing around with AI stuff, using Codex. It includes Python, Node, gh and the Codex CLI. Running in a devcontainer gives me a clean environment to mess with and further sandboxes the coding agent.
To use create a .devcontainer directory in your project and add the following devcontainer.json file:
{
"name": "Minimal Codex And Dev Container",
"image": "mcr.microsoft.com/devcontainers/base:trixie",
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers/features/node:1": {},
"ghcr.io/devcontainers/features/python:1": {}
},
// -i to force interactive shell which nvm requires
"postCreateCommand": "bash -i .devcontainer/complete_setup.sh"
}
Then add the following complete_setup.sh script to the same directory:
#!/bin/bash
# install latest node
nvm install --lts && nvm use --lts
# install codex
npm install -g @openai/codex
# install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
Then launch your devcontainer. I use VS Code to do this.
Finally run codex with:
codex -c sandbox_workspace_write.network_access=true --search
This gives codex access to the network and ability to perform web searches.