You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/manuals/ai/sandboxes/claude-code.md
+17-12Lines changed: 17 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,21 +35,23 @@ This starts Claude and immediately processes the prompt.
35
35
36
36
## Authentication
37
37
38
-
Claude Code needs an Anthropic API key to work. The recommended approach is to
39
-
set the `ANTHROPIC_API_KEY` environment variable in your shell configuration
40
-
file.
38
+
Claude Code requires an Anthropic API key. You can authenticate using an environment variable (recommended) or through interactive login.
41
39
42
-
Docker Sandboxes run through a daemon process that doesn't inherit environment
40
+
### Environment variable (recommended)
41
+
42
+
The recommended approach is to set the `ANTHROPIC_API_KEY` environment variable in your shell configuration file.
43
+
44
+
Docker Sandboxes use a daemon process that doesn't inherit environment
43
45
variables from your current shell session. To make your API key available to
44
-
sandboxes, you need to set it globally in your shell configuration file.
46
+
sandboxes, set it globally in your shell configuration file.
45
47
46
48
Add the API key to your shell configuration file:
47
49
48
50
```plaintext {title="~/.bashrc or ~/.zshrc"}
49
51
export ANTHROPIC_API_KEY=sk-ant-api03-xxxxx
50
52
```
51
53
52
-
Then apply the changes:
54
+
Apply the changes:
53
55
54
56
1. Source your shell configuration: `source ~/.bashrc` (or `~/.zshrc`)
55
57
2. Restart Docker Desktop so the daemon picks up the new environment variable
@@ -60,16 +62,19 @@ $ docker sandbox create claude ~/project
60
62
$ docker sandbox run <sandbox-name>
61
63
```
62
64
63
-
The sandbox will detect the environment variable and use it automatically.
65
+
The sandbox detects the environment variable and uses it automatically.
64
66
65
67
### Interactive authentication
66
68
67
-
If no credentials are found, Claude Code prompts you to authenticate when it
68
-
starts. You'll need to authenticate for each workspace separately when using
69
-
this method.
69
+
If no credentials are found, Claude Code prompts you to authenticate interactively when it starts. You can also trigger the login flow manually using the `/login` command within Claude Code.
70
+
71
+
When using interactive authentication:
72
+
73
+
- You'll need to authenticate for each workspace/sandbox separately
74
+
- If the sandbox is removed or destroyed, you'll need to authenticate again when you recreate it
75
+
- Authentication sessions aren't persisted outside the sandbox
70
76
71
-
To avoid repeated authentication, use the `ANTHROPIC_API_KEY` environment
72
-
variable method described above.
77
+
To avoid repeated authentication, use the `ANTHROPIC_API_KEY` environment variable method described above.
0 commit comments