Sign inSign up

shrizt/claude-box

By shrizt

Updated 5 months ago

SSH-accessible container with Claude Code. Add to gluetun vpn/proxy network if needed )

Image
Machine learning & AI
Developer tools
0

1.7K

shrizt/claude-box repository overview

Claude-box: Claude code container

SSH-accessible container with Claude Code, designed for linux hosts. Install Claude code with ease. Add to gluetun vpn/proxy network if needed )

If claude halted on first run, see known issue in the end.

Data persistance

Claude settings being stored outside the container for future use. By default being linked from userhome (~/) to external volume: Dirs: .claude .cache .config .ssh Files: .gitconfig .claude.json

You may add your files and dirs to be stored outside from ~/ to /workspace/home

Setup

Claude may be run via SSH or docker exec.

1. Config and run the container

Use compose yaml for detailed config:

services:     
  claude-box:
    image: shrizt/claude-box
    volumes:
      - /host/path/claude-box:/workspace/home   # persistent Claude auth/config     
      - /host/path/git:/workspace/git     # mount your source code 
    environment:
      HOME: /workspace/home
      SSH_PORT: 2222 #set a port for sshd 
      ROOT_PASSWORD: claudebox #optional change ssh access password
      # Add your files and dirs to keep outside using ENV PERSIST_DIRS, PERSIST_FILES (will be linked to /workspace/home volume)
      PERSIST_DIRS: myfolder myfolder2
      PERSIST_FILES: .myfile1 .myfile2
      ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY:-}   # set in .env file
      # If using Claude.ai Pro/Max OAuth instead of API key, leave blank
      #   and authenticate interactively after SSH-ing in

or run as

docker run -v /host/path/claude-box:/workspace/home -v /host/git:/workspace/git \
-e SSH_PORT=2222 -p 2222:2222 shrizt/claude-box
2. Get In

SSH-ing

ssh root@yourhost -p 2222 # default password: claudebox - may change via ENV

or direct into container from host:

docker exec -it claude-container bash
3. Use Claude Code
# Inside container:
cd /workspace
claude                    # interactive mode
claude-tty      # start Claude with PTY fix (use if UI hangs on some ssh clients)
claude --dangerously-skip-permissions  # no prompts (automated)

Known issue : First run git SSH claude bug

claude on first run may try to ssh to github and halt on there. If so, RUN git config --global url."https://github.com/anthropics/".insteadOf "ssh://[email protected]/anthropics/" to remove halt of claude trying to ssh to github more info - https://github.com/anthropics/claude-code/issues/14346

Feedback

Feel free to send me a feedback to [email protected], will appreciate any! BR!

Tag summary

Content type

Image

Digest

sha256:67ad941de

Size

92.1 MB

Last updated

5 months ago

docker pull shrizt/claude-box