@@ -29,36 +29,49 @@ docker run -it --rm \
2929 ungb/codex
3030```
3131
32- ### One-Shot Commands
32+ ### One-Shot Commands (Non-Interactive)
33+
34+ Use ` codex exec ` (or ` codex e ` ) for non-interactive mode:
3335
3436``` bash
3537# Ask a question about your codebase
3638docker run -it --rm \
3739 -v $( pwd) :/workspace \
3840 -e OPENAI_API_KEY=$OPENAI_API_KEY \
3941 ungb/codex \
40- codex " explain the architecture of this project"
42+ codex exec " explain the architecture of this project"
4143
4244# Generate code
4345docker run -it --rm \
4446 -v $( pwd) :/workspace \
4547 -e OPENAI_API_KEY=$OPENAI_API_KEY \
4648 ungb/codex \
47- codex " add input validation to the user form"
49+ codex exec " add input validation to the user form"
4850
49- # Fix bugs
51+ # Fix bugs (with auto-approval)
5052docker run -it --rm \
5153 -v $( pwd) :/workspace \
5254 -e OPENAI_API_KEY=$OPENAI_API_KEY \
5355 ungb/codex \
54- codex " fix the type errors in src/utils"
56+ codex exec --ask-for-approval never " fix the type errors in src/utils"
5557
56- # Refactor code
58+ # JSON output (for scripts/automation)
5759docker run -it --rm \
5860 -v $( pwd) :/workspace \
5961 -e OPENAI_API_KEY=$OPENAI_API_KEY \
6062 ungb/codex \
61- codex " refactor this function to use async/await"
63+ codex exec --json " list all TODO comments"
64+ ```
65+
66+ ### Piping Input
67+
68+ ``` bash
69+ # Pipe prompt from stdin
70+ echo " explain this code" | docker run -i --rm \
71+ -v $( pwd) :/workspace \
72+ -e OPENAI_API_KEY=$OPENAI_API_KEY \
73+ ungb/codex \
74+ codex exec -
6275```
6376
6477### With Full Configuration (Recommended)
@@ -94,8 +107,8 @@ echo "OPENAI_API_KEY=your-key-here" > .env
94107# Interactive session
95108docker compose run --rm codex
96109
97- # One-shot command
98- docker compose run --rm codex codex " explain this code"
110+ # One-shot command (non-interactive)
111+ docker compose run --rm codex codex exec " explain this code"
99112```
100113
101114### Full Auto Mode (Careful!)
@@ -107,6 +120,13 @@ docker run -it --rm \
107120 -e OPENAI_API_KEY=$OPENAI_API_KEY \
108121 ungb/codex \
109122 codex --full-auto " implement the TODO items in this file"
123+
124+ # YOLO mode - no approvals, no sandbox (dangerous!)
125+ docker run -it --rm \
126+ -v $( pwd) :/workspace \
127+ -e OPENAI_API_KEY=$OPENAI_API_KEY \
128+ ungb/codex \
129+ codex exec --yolo " fix the failing tests"
110130```
111131
112132### Quiet Mode
@@ -117,7 +137,7 @@ docker run -it --rm \
117137 -v $( pwd) :/workspace \
118138 -e OPENAI_API_KEY=$OPENAI_API_KEY \
119139 ungb/codex \
120- codex --quiet " fix the failing tests "
140+ codex --quiet
121141```
122142
123143## Sharing Your Codex Configuration
@@ -373,7 +393,8 @@ alias codex-docker='docker run -it --rm \
373393 -e OPENAI_API_KEY=$OPENAI_API_KEY \
374394 ungb/codex codex'
375395
376- # Usage: codex-docker "explain this code"
396+ # Usage (interactive): codex-docker
397+ # Usage (one-shot): codex-docker exec "explain this code"
377398```
378399
379400## License
0 commit comments