Skip to content

Commit c2b0ff4

Browse files
authored
Merge pull request #24044 from docker/agent/issue-24043
docs: address issue #24043
2 parents e5d9918 + 7a86604 commit c2b0ff4

File tree

2 files changed

+26
-16
lines changed

2 files changed

+26
-16
lines changed

content/manuals/ai/sandboxes/claude-code.md

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,23 @@ This starts Claude and immediately processes the prompt.
3535

3636
## Authentication
3737

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.
4139

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
4345
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.
4547

4648
Add the API key to your shell configuration file:
4749

4850
```plaintext {title="~/.bashrc or ~/.zshrc"}
4951
export ANTHROPIC_API_KEY=sk-ant-api03-xxxxx
5052
```
5153

52-
Then apply the changes:
54+
Apply the changes:
5355

5456
1. Source your shell configuration: `source ~/.bashrc` (or `~/.zshrc`)
5557
2. Restart Docker Desktop so the daemon picks up the new environment variable
@@ -60,16 +62,19 @@ $ docker sandbox create claude ~/project
6062
$ docker sandbox run <sandbox-name>
6163
```
6264

63-
The sandbox will detect the environment variable and use it automatically.
65+
The sandbox detects the environment variable and uses it automatically.
6466

6567
### Interactive authentication
6668

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
7076

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.
7378

7479
## Configuration
7580

content/manuals/ai/sandboxes/get-started.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ weight: 20
77

88
{{< summary-bar feature_name="Docker Sandboxes" >}}
99

10-
This guide runs Claude Code in an isolated sandbox for the first time.
10+
This guide shows how to run Claude Code in an isolated sandbox for the first time.
1111

1212
> [!NOTE]
1313
> Upgrading from an earlier version of Docker Desktop? See the
@@ -20,13 +20,13 @@ Before you begin, ensure you have:
2020

2121
- Docker Desktop 4.58 or later
2222
- macOS, or Windows {{< badge color=violet text=Experimental >}}
23-
- A Claude API key
23+
- A Claude API key (can be provided via environment variable or interactively)
2424

2525
## Run your first sandbox
2626

2727
Follow these steps to run Claude Code:
2828

29-
1. Set your Anthropic API key as an environment variable.
29+
1. (Optional but recommended) Set your Anthropic API key as an environment variable.
3030

3131
Add the API key to your shell configuration file:
3232

@@ -39,10 +39,15 @@ Follow these steps to run Claude Code:
3939
in your current session will not work. You must set it globally in your
4040
shell configuration file to ensure the daemon can access it.
4141

42-
Then apply the changes:
42+
Apply the changes:
4343
1. Source your shell configuration.
4444
2. Restart Docker Desktop so the daemon picks up the new environment variable.
4545

46+
Alternatively, you can skip this step and authenticate interactively when
47+
Claude Code starts. If no credentials are found, you'll be prompted to log
48+
in. Note that interactive authentication requires you to authenticate for
49+
each workspace separately.
50+
4651
2. Create and run a sandbox for Claude Code for your workspace:
4752

4853
```console

0 commit comments

Comments
 (0)