Skip to content
This repository was archived by the owner on Feb 20, 2026. It is now read-only.

Commit 7af3402

Browse files
jlaustillclaude
andcommitted
Add Linux Docker socket support and fix OAuth credential discovery
- Add rootless Docker socket paths ($XDG_RUNTIME_DIR/docker.sock, /run/user/<uid>/docker.sock) - Add Docker Desktop for Linux socket path (~/.docker/desktop/docker.sock) - Add Colima socket paths for macOS (~/.colima/default/docker.sock, ~/.docker/run/docker.sock) - Fix OAuth credential detection to find ~/.claude/.credentials.json with claudeAiOauth key - Exclude actively-written directories when copying .claude config to prevent tar errors Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 61cfa97 commit 7af3402

3 files changed

Lines changed: 39 additions & 7 deletions

File tree

src/container.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,20 @@ exec claude --dangerously-skip-permissions' > /start-claude.sh && \\
790790
const tarFlags = getTarFlags();
791791
// On macOS, also exclude extended attributes that cause Docker issues
792792
const additionalFlags = (process.platform as string) === "darwin" ? "--no-xattrs --no-fflags" : "";
793-
const combinedFlags = `${tarFlags} ${additionalFlags}`.trim();
793+
// Exclude directories that are large, temporary, or actively written to
794+
const excludeFlags = [
795+
"--exclude=.claude/debug",
796+
"--exclude=.claude/cache",
797+
"--exclude=.claude/file-history",
798+
"--exclude=.claude/session-env",
799+
"--exclude=.claude/tasks",
800+
"--exclude=.claude/paste-cache",
801+
"--exclude=.claude/shell-snapshots",
802+
"--exclude=.claude/telemetry",
803+
"--exclude=.claude/todos",
804+
"--exclude=.claude/statsig",
805+
].join(" ");
806+
const combinedFlags = `${tarFlags} ${additionalFlags} ${excludeFlags}`.trim();
794807
execSync(
795808
`tar -cf "${tarFile}" ${combinedFlags} -C "${os.homedir()}" .claude`,
796809
{

src/credentials.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,25 +85,31 @@ export class CredentialManager {
8585
}
8686

8787
private async findOAuthToken(): Promise<string | null> {
88-
// Check common locations for Claude OAuth tokens
88+
// Check common locations for Claude OAuth tokens/credentials
8989
const possiblePaths = [
90+
// Linux/cross-platform credential locations
91+
path.join(os.homedir(), ".claude", ".credentials.json"),
9092
path.join(os.homedir(), ".claude", "auth.json"),
93+
path.join(os.homedir(), ".config", "claude", "auth.json"),
94+
// macOS credential locations
9195
path.join(
9296
os.homedir(),
9397
"Library",
9498
"Application Support",
9599
"Claude",
96100
"auth.json",
97101
),
98-
path.join(os.homedir(), ".config", "claude", "auth.json"),
99102
];
100103

101104
for (const authPath of possiblePaths) {
102105
try {
103106
const content = await fs.readFile(authPath, "utf-8");
104107
const auth = JSON.parse(content);
105-
if (auth.access_token) {
106-
return auth.access_token;
108+
// Check various token field names used by Claude Code
109+
if (auth.claudeAiOauth || auth.accessToken || auth.access_token) {
110+
// Return indicator that OAuth credentials exist
111+
// The actual credentials will be copied via _copyClaudeConfig
112+
return "oauth-credentials-found";
107113
}
108114
} catch {
109115
// Continue checking other paths

src/docker-config.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import * as fs from "fs";
22
import * as path from "path";
3+
import * as os from "os";
34

45
interface DockerConfig {
56
socketPath?: string;
67
}
78

89
/**
9-
* Detects whether Docker or Podman is available and returns appropriate configuration
10+
* Detects whether Docker, Colima, or Podman is available and returns appropriate configuration
1011
* @param customSocketPath - Optional custom socket path from configuration
1112
*/
1213
export function getDockerConfig(customSocketPath?: string): DockerConfig {
@@ -22,9 +23,21 @@ export function getDockerConfig(customSocketPath?: string): DockerConfig {
2223

2324
// Common socket paths to check
2425
const socketPaths = [
25-
// Docker socket paths
26+
// Docker standard socket paths
2627
"/var/run/docker.sock",
2728

29+
// Docker rootless socket paths (Linux)
30+
process.env.XDG_RUNTIME_DIR &&
31+
path.join(process.env.XDG_RUNTIME_DIR, "docker.sock"),
32+
`/run/user/${process.getuid?.() || 1000}/docker.sock`,
33+
34+
// Docker Desktop for Linux
35+
path.join(os.homedir(), ".docker", "desktop", "docker.sock"),
36+
37+
// Colima socket paths (macOS)
38+
path.join(os.homedir(), ".colima", "default", "docker.sock"),
39+
path.join(os.homedir(), ".docker", "run", "docker.sock"),
40+
2841
// Podman rootless socket paths
2942
process.env.XDG_RUNTIME_DIR &&
3043
path.join(process.env.XDG_RUNTIME_DIR, "podman", "podman.sock"),

0 commit comments

Comments
 (0)