@alanbem/dclaude 0.0.14 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -16
- package/dclaude +35 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,29 +1,31 @@
|
|
|
1
|
-
# dclaude
|
|
1
|
+
# dclaude — Dockerized Claude Code
|
|
2
2
|
|
|
3
|
+
[](https://github.com/alanbem/dclaude/actions/workflows/ci-cd.yml)
|
|
3
4
|
[](https://opensource.org/licenses/MIT)
|
|
4
|
-
[](https://hub.docker.com/r/alanbem/dclaude)
|
|
5
6
|
[](https://www.npmjs.com/package/@alanbem/dclaude)
|
|
6
7
|
|
|
7
|
-
Run Claude Code CLI in Docker
|
|
8
|
+
Run Claude Code CLI in Docker — no local installation needed. Full MCP support, persistent sessions, and seamless host integration.
|
|
8
9
|
|
|
9
10
|
## Why dclaude?
|
|
10
11
|
|
|
11
12
|
**Claude Code CLI is powerful, but installing it locally means:**
|
|
12
|
-
- Node.js version conflicts
|
|
13
|
-
- Global npm packages cluttering your system
|
|
14
13
|
- MCP servers needing specific Python/Node setups
|
|
15
14
|
- Different behavior across machines
|
|
15
|
+
- Claude has access to your entire filesystem
|
|
16
16
|
|
|
17
17
|
**dclaude solves this by running Claude in a container that feels native:**
|
|
18
|
+
- **Safer `--dangerously-skip-permissions`** - container isolation means Claude can only access your project, not your whole system
|
|
18
19
|
- Your files appear at the same paths (no `/app` or `/workspace` confusion)
|
|
19
20
|
- Docker commands work (socket is mounted)
|
|
20
21
|
- SSH keys and git config just work
|
|
21
22
|
- Homebrew included - easy migration from local macOS setup
|
|
22
23
|
- Works on Linux, macOS, and Windows
|
|
23
|
-
- **Safer `--dangerously-skip-permissions`** - container isolation means Claude can only access your project, not your whole system
|
|
24
24
|
|
|
25
25
|
## Quick Start
|
|
26
26
|
|
|
27
|
+
> **Prerequisite:** A Docker-compatible runtime such as [Docker Desktop](https://docs.docker.com/get-docker/), [OrbStack](https://orbstack.dev/), or [Colima](https://github.com/abiosoft/colima) must be installed and running.
|
|
28
|
+
|
|
27
29
|
### Install via NPM (Recommended)
|
|
28
30
|
|
|
29
31
|
```bash
|
|
@@ -42,6 +44,8 @@ sudo ln -s ~/tools/dclaude/dclaude /usr/local/bin/dclaude
|
|
|
42
44
|
dclaude
|
|
43
45
|
```
|
|
44
46
|
|
|
47
|
+
> **First run:** The Docker image (~1GB) is pulled automatically on first launch. You'll be prompted to authenticate with your Anthropic account.
|
|
48
|
+
|
|
45
49
|
## Basic Usage
|
|
46
50
|
|
|
47
51
|
**dclaude passes all arguments directly to Claude CLI** - use it exactly as you would use `claude`:
|
|
@@ -69,9 +73,10 @@ dclaude exec brew install ripgrep
|
|
|
69
73
|
dclaude creates a container that mirrors your host environment:
|
|
70
74
|
|
|
71
75
|
1. **Path Mirroring**: Your current directory is mounted at the *same path*
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
76
|
+
```
|
|
77
|
+
Host: /Users/alice/projects/myapp ──mount──> Container: /Users/alice/projects/myapp
|
|
78
|
+
```
|
|
79
|
+
No `/app` or `/workspace` confusion — all your file paths just work
|
|
75
80
|
|
|
76
81
|
2. **Docker Access**: The Docker socket is mounted, so Claude can build images, run containers, and manage compose stacks
|
|
77
82
|
|
|
@@ -112,7 +117,7 @@ DCLAUDE_GIT_AUTH=agent-forwarding dclaude
|
|
|
112
117
|
DCLAUDE_GIT_AUTH=key-mount dclaude
|
|
113
118
|
```
|
|
114
119
|
|
|
115
|
-
|
|
120
|
+
dclaude warns you if no keys are loaded and suggests `dclaude ssh keys` to load them automatically (see also [SSH Key and Server Management](#ssh-key-and-server-management)).
|
|
116
121
|
|
|
117
122
|
### Homebrew Support
|
|
118
123
|
|
|
@@ -132,9 +137,19 @@ dclaude gh # Interactive GitHub login
|
|
|
132
137
|
dclaude exec gh pr list # Use gh commands
|
|
133
138
|
```
|
|
134
139
|
|
|
140
|
+
### Git Configuration
|
|
141
|
+
|
|
142
|
+
SSH agent forwarding provides authentication for git, but git also needs your identity (name/email) for commits. Use `dclaude git` to configure this:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
dclaude git # Configure git name/email in container
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
This reads your host's `~/.gitconfig` and offers to copy the identity into the container's persistent volume.
|
|
149
|
+
|
|
135
150
|
### SSH Key and Server Management
|
|
136
151
|
|
|
137
|
-
Load SSH keys and start SSH server for JetBrains Gateway, VS Code Remote, or any SSH client:
|
|
152
|
+
Load SSH keys and start SSH server for JetBrains Gateway, VS Code Remote, or any SSH client (see also [SSH Authentication](#ssh-authentication)):
|
|
138
153
|
|
|
139
154
|
```bash
|
|
140
155
|
dclaude ssh # Load keys + start SSH server
|
|
@@ -147,13 +162,17 @@ dclaude ssh server --stop # Stop SSH server
|
|
|
147
162
|
|
|
148
163
|
### Chrome DevTools Integration
|
|
149
164
|
|
|
150
|
-
Control Chrome via MCP for browser automation:
|
|
165
|
+
Control Chrome via MCP for browser automation. Chrome runs on the host with remote debugging; Claude connects from the container:
|
|
151
166
|
|
|
152
167
|
```bash
|
|
153
|
-
dclaude chrome # Launch Chrome with DevTools
|
|
168
|
+
dclaude chrome # Launch Chrome with DevTools + create .mcp.json
|
|
169
|
+
dclaude chrome --port=9223 # Use custom debugging port
|
|
170
|
+
dclaude chrome --setup-only # Create .mcp.json without launching Chrome
|
|
154
171
|
dclaude # Claude can now interact with the browser
|
|
155
172
|
```
|
|
156
173
|
|
|
174
|
+
Chrome profiles are stored per-project in `.dclaude.d/chrome/profiles/`. Customize with `DCLAUDE_CHROME_PROFILE`, `DCLAUDE_CHROME_PORT`, `DCLAUDE_CHROME_BIN`, and `DCLAUDE_CHROME_FLAGS`.
|
|
175
|
+
|
|
157
176
|
### AWS CLI Integration
|
|
158
177
|
|
|
159
178
|
AWS CLI v2 is pre-installed in the container. Configure how AWS credentials are provided:
|
|
@@ -211,6 +230,24 @@ This helps Claude understand its environment without you explaining it. Disable
|
|
|
211
230
|
DCLAUDE_SYSTEM_CONTEXT=false dclaude
|
|
212
231
|
```
|
|
213
232
|
|
|
233
|
+
## Container Management
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
# Session management
|
|
237
|
+
dclaude new # Start a new Claude session
|
|
238
|
+
dclaude attach <session> # Reattach to a named tmux session
|
|
239
|
+
DCLAUDE_TMUX_SESSION=reviewer dclaude # Start a named session
|
|
240
|
+
|
|
241
|
+
# Container lifecycle
|
|
242
|
+
dclaude stop # Stop container for current directory
|
|
243
|
+
dclaude rm # Remove container (add -f to force)
|
|
244
|
+
|
|
245
|
+
# Maintenance
|
|
246
|
+
dclaude pull # Pull latest Docker image
|
|
247
|
+
dclaude update # Update Claude CLI inside container
|
|
248
|
+
dclaude shell # Open a bash shell (alias for exec)
|
|
249
|
+
```
|
|
250
|
+
|
|
214
251
|
## Environment Variables
|
|
215
252
|
|
|
216
253
|
| Variable | Default | Description |
|
|
@@ -226,7 +263,9 @@ DCLAUDE_SYSTEM_CONTEXT=false dclaude
|
|
|
226
263
|
| `DCLAUDE_NO_UPDATE` | `false` | Skip image update check |
|
|
227
264
|
| `DCLAUDE_SYSTEM_CONTEXT` | `true` | Inform Claude about container environment |
|
|
228
265
|
| `DCLAUDE_AWS_CLI` | `auto` | AWS config: `auto`, `mount`, `volume`, `none` |
|
|
266
|
+
| `DCLAUDE_TMUX_SESSION` | `claude-TIMESTAMP` | Custom tmux session name for concurrent sessions |
|
|
229
267
|
| `DCLAUDE_ITERM2` | `true` | Enable iTerm2 shell integration (only affects iTerm2) |
|
|
268
|
+
| `DCLAUDE_CA_CERT` | (none) | Path to CA certificate for corporate SSL inspection |
|
|
230
269
|
|
|
231
270
|
## Configuration File
|
|
232
271
|
|
|
@@ -237,6 +276,7 @@ Create a `.dclaude` file at your project root to configure dclaude for that dire
|
|
|
237
276
|
NAMESPACE=mycompany
|
|
238
277
|
NETWORK=host
|
|
239
278
|
DEBUG=true
|
|
279
|
+
CA_CERT=certs/corporate-ca.pem
|
|
240
280
|
```
|
|
241
281
|
|
|
242
282
|
dclaude walks up the directory tree to find `.dclaude` files. Any dclaude session started from that directory or any subdirectory will use these settings.
|
|
@@ -252,6 +292,9 @@ dclaude walks up the directory tree to find `.dclaude` files. Any dclaude sessio
|
|
|
252
292
|
| `DEBUG` | Enable debug output (`true`, `false`) |
|
|
253
293
|
| `CHROME_PORT` | Chrome DevTools port |
|
|
254
294
|
| `AWS_CLI` | AWS config mode (`mount`, `volume`, `none`) |
|
|
295
|
+
| `CA_CERT` | Path to CA certificate for corporate SSL inspection (relative to config file, or absolute) |
|
|
296
|
+
|
|
297
|
+
Config file variables are the unprefixed equivalents of `DCLAUDE_*` environment variables (e.g., `NAMESPACE` in `.dclaude` = `DCLAUDE_NAMESPACE` env var).
|
|
255
298
|
|
|
256
299
|
**Precedence:** Environment variables override `.dclaude` file settings.
|
|
257
300
|
|
|
@@ -347,13 +390,13 @@ DCLAUDE_NETWORK=bridge dclaude
|
|
|
347
390
|
|----------|--------|-------|
|
|
348
391
|
| Linux | Full support | Host networking available |
|
|
349
392
|
| macOS | Full support | Host networking with OrbStack or Docker Desktop beta |
|
|
350
|
-
| Windows | Full support | WSL2
|
|
393
|
+
| Windows | Full support | Requires WSL2; host networking with Docker Desktop beta features |
|
|
351
394
|
|
|
352
395
|
## What's Included
|
|
353
396
|
|
|
354
397
|
The container includes:
|
|
355
398
|
- **Ubuntu 24.04 LTS** base
|
|
356
|
-
- **Claude Code CLI** (latest)
|
|
399
|
+
- **Claude Code CLI** (latest, AMD64 and ARM64/Apple Silicon)
|
|
357
400
|
- **Node.js 20+**, **Python 3** with pip
|
|
358
401
|
- **Homebrew/Linuxbrew** for package management
|
|
359
402
|
- **Docker CLI** and **Docker Compose**
|
|
@@ -417,6 +460,21 @@ mv problematic-dir problematic-dir.tmp && mv problematic-dir.tmp problematic-dir
|
|
|
417
460
|
|
|
418
461
|
Upgrading to the latest OrbStack version may also help.
|
|
419
462
|
|
|
463
|
+
## Shell Completions
|
|
464
|
+
|
|
465
|
+
Tab completion is available for bash and zsh:
|
|
466
|
+
|
|
467
|
+
```bash
|
|
468
|
+
# Bash — add to ~/.bashrc
|
|
469
|
+
source "$(npm root -g)/@alanbem/dclaude/completions/dclaude.bash"
|
|
470
|
+
|
|
471
|
+
# Zsh — add to ~/.zshrc
|
|
472
|
+
source "$(npm root -g)/@alanbem/dclaude/completions/dclaude.zsh"
|
|
473
|
+
|
|
474
|
+
# Source install — use the repo path directly
|
|
475
|
+
source ~/tools/dclaude/completions/dclaude.bash
|
|
476
|
+
```
|
|
477
|
+
|
|
420
478
|
## Project Structure
|
|
421
479
|
|
|
422
480
|
```text
|
|
@@ -426,7 +484,9 @@ Upgrading to the latest OrbStack version may also help.
|
|
|
426
484
|
│ ├── Dockerfile # Container image definition
|
|
427
485
|
│ ├── README.md # Docker Hub documentation
|
|
428
486
|
│ ├── usr/local/bin/
|
|
429
|
-
│ │
|
|
487
|
+
│ │ ├── docker-entrypoint.sh
|
|
488
|
+
│ │ ├── claude-launcher.sh
|
|
489
|
+
│ │ └── tmux-wrapper.sh
|
|
430
490
|
│ └── home/claude/
|
|
431
491
|
│ └── .tmux.conf
|
|
432
492
|
├── .github/workflows/ # CI/CD (lint, scan, publish)
|
package/dclaude
CHANGED
|
@@ -138,6 +138,18 @@ load_config_file() {
|
|
|
138
138
|
AWS_CLI)
|
|
139
139
|
[[ -z "${DCLAUDE_AWS_CLI:-}" ]] && DCLAUDE_AWS_CLI="$value"
|
|
140
140
|
;;
|
|
141
|
+
CA_CERT)
|
|
142
|
+
if [[ -z "${DCLAUDE_CA_CERT:-}" ]]; then
|
|
143
|
+
# Resolve relative paths relative to config file's directory
|
|
144
|
+
if [[ "$value" != /* ]]; then
|
|
145
|
+
local config_dir
|
|
146
|
+
config_dir=$(dirname "$config_file")
|
|
147
|
+
DCLAUDE_CA_CERT=$(cd "$config_dir" && realpath "$value" 2>/dev/null)
|
|
148
|
+
else
|
|
149
|
+
DCLAUDE_CA_CERT="$value"
|
|
150
|
+
fi
|
|
151
|
+
fi
|
|
152
|
+
;;
|
|
141
153
|
esac
|
|
142
154
|
fi
|
|
143
155
|
done < "$config_file"
|
|
@@ -155,6 +167,11 @@ readonly GIT_AUTH_MODE="${DCLAUDE_GIT_AUTH:-auto}" # auto, agent-forwarding, ke
|
|
|
155
167
|
readonly NAMESPACE="${DCLAUDE_NAMESPACE:-}"
|
|
156
168
|
CHROME_PORT="${DCLAUDE_CHROME_PORT:-9222}"
|
|
157
169
|
readonly AWS_CLI_MODE="${DCLAUDE_AWS_CLI:-auto}" # auto, mount, volume, none
|
|
170
|
+
# Resolve CA_CERT relative paths (env var: relative to PWD, config file: already resolved)
|
|
171
|
+
if [[ -n "${DCLAUDE_CA_CERT:-}" && "${DCLAUDE_CA_CERT}" != /* ]]; then
|
|
172
|
+
DCLAUDE_CA_CERT=$(realpath "$DCLAUDE_CA_CERT" 2>/dev/null) || DCLAUDE_CA_CERT="$PWD/$DCLAUDE_CA_CERT"
|
|
173
|
+
fi
|
|
174
|
+
readonly CA_CERT="${DCLAUDE_CA_CERT:-}" # Path to CA certificate for corporate proxies
|
|
158
175
|
|
|
159
176
|
# Show config file if loaded (always at info level, details at debug)
|
|
160
177
|
if [[ -n "$DCLAUDE_CONFIG_FILE" ]]; then
|
|
@@ -166,6 +183,7 @@ if [[ -n "$DCLAUDE_CONFIG_FILE" ]]; then
|
|
|
166
183
|
[[ -n "${DCLAUDE_CHROME_PORT:-}" ]] && debug " CHROME_PORT=$DCLAUDE_CHROME_PORT"
|
|
167
184
|
[[ -n "${DCLAUDE_MOUNT_ROOT:-}" ]] && debug " MOUNT_ROOT=$DCLAUDE_MOUNT_ROOT"
|
|
168
185
|
[[ -n "${DCLAUDE_AWS_CLI:-}" ]] && debug " AWS_CLI=$DCLAUDE_AWS_CLI"
|
|
186
|
+
[[ -n "$CA_CERT" ]] && debug " CA_CERT=$CA_CERT"
|
|
169
187
|
fi
|
|
170
188
|
fi
|
|
171
189
|
|
|
@@ -1914,6 +1932,23 @@ main() {
|
|
|
1914
1932
|
;;
|
|
1915
1933
|
esac
|
|
1916
1934
|
|
|
1935
|
+
# Handle CA certificate for corporate proxies / SSL inspection
|
|
1936
|
+
# The cert file must be within the mounted directory tree to be accessible inside the container
|
|
1937
|
+
if [[ -n "$CA_CERT" ]]; then
|
|
1938
|
+
if [[ ! -f "$CA_CERT" ]]; then
|
|
1939
|
+
warning "CA certificate not found: $CA_CERT"
|
|
1940
|
+
elif [[ "$CA_CERT" != "$MOUNT_ROOT"* ]]; then
|
|
1941
|
+
warning "CA certificate is outside the mounted directory: $CA_CERT"
|
|
1942
|
+
warning "It must be within: $MOUNT_ROOT"
|
|
1943
|
+
else
|
|
1944
|
+
DOCKER_ARGS+=(
|
|
1945
|
+
-e "NODE_EXTRA_CA_CERTS=${CA_CERT}"
|
|
1946
|
+
-e "SSL_CERT_FILE=${CA_CERT}"
|
|
1947
|
+
)
|
|
1948
|
+
info "CA certificate: $CA_CERT"
|
|
1949
|
+
fi
|
|
1950
|
+
fi
|
|
1951
|
+
|
|
1917
1952
|
# Add any additional environment variables
|
|
1918
1953
|
if [[ -n "${CLAUDE_MODEL:-}" ]]; then
|
|
1919
1954
|
DOCKER_ARGS+=(-e "CLAUDE_MODEL=${CLAUDE_MODEL}")
|