A powerful tool for running projects in isolated Docker containers with Docker-in-Docker support.
- Isolated Environments: Run your project in clean Docker containers
- Docker-in-Docker: Run complex Docker workflows in complete isolation
- Service Discovery: Automatic subdomain routing for multi-service projects
- Zero Configuration: Works out of the box with sensible defaults
- Real-time Development: Mount mode for live code changes
# Install worklet
go install github.com/nolanleung/worklet@latest
# Initialize configuration
worklet init
# Run your project in an isolated container
worklet run
# Or run with your local directory mounted
worklet run --mount
# Run a specific command
worklet run npm test
# Open interactive session manager
workletgo install github.com/nolanleung/worklet@latestgit clone https://github.com/nolanleung/worklet
cd worklet
go build -o worklet .
sudo mv worklet /usr/local/bin/Run your project in a clean Docker container with one command. Each session is isolated, allowing you to experiment without fear.
- Full isolation mode (default): Runs a separate Docker daemon inside the container
- Shared mode: Uses host Docker daemon for resource efficiency
- Perfect for testing Docker Compose setups, building images, or running containerized tests
- Isolated mode (default): Creates a persistent isolated environment
- Mount mode (
--mount): Mounts your current directory for real-time development - Temporary mode (
--temp): Creates a temporary environment that auto-cleans up
- Automatic subdomain routing for multi-service projects
- Access services via
service.project-name.worklet.sh - Built-in proxy server for local development
- Open containers directly in VSCode with Dev Containers extension
- Automatic devcontainer.json generation with your extensions
- Seamless development experience with full IDE support
The worklet binary includes all necessary scripts. No external dependencies beyond Docker.
- Run initialization commands automatically when containers start
- Mount SSH credentials for Git operations inside containers
- Support for private repositories and SSH-based workflows
Create a .worklet.jsonc file in your repository root:
Launch interactive session manager to view and manage all active worklet sessions.
worklet # Open interactive CLI
# Features:
# - View all active sessions with project info
# - Connect to sessions (Enter key)
# - Open in VSCode (v key)
# - Delete sessions (d key)
# - Refresh view (r key)Initialize a new .worklet.jsonc configuration file.
worklet init
# Creates .worklet.jsonc with default configurationRun your project in a Docker container.
worklet run # Run in isolated environment
worklet run --mount # Run with current directory mounted
worklet run --temp # Run in temporary environment
worklet run npm test # Run specific command
worklet run --mount npm start # Run with mount and command
# Terminal server options
worklet run --no-terminal # Disable terminal server
worklet run --open-terminal # Auto-open terminal in browser
worklet run --terminal-port 8080 # Use custom terminal port
# Credential options
worklet run --link-claude # Auto-link Claude credentials (default for cloned repos)Start a web-based terminal server for browser-based access to containers.
worklet terminal # Start terminal server on port 7681
worklet terminal --port 8080 # Use custom port
worklet terminal --proxy # Enable service proxyFeatures:
- Browser-based terminal with full TTY support
- Automatic container discovery
- Service proxy for accessing project services via subdomains
Link external tools and services to your worklet configuration.
worklet link claude # Enable Claude in worklet configuration
worklet link claude --force # Force overwrite existing Claude settingsThe link command adds necessary credential settings to your .worklet.jsonc configuration.
Manage credentials for external services used by worklet.
worklet credentials claude # Configure Claude API credentialsThis command securely stores credentials that can be mounted into worklet containers when credentials.claude is enabled in your configuration.
Manage the worklet daemon for service discovery and proxy routing.
worklet daemon start # Start the daemon
worklet daemon stop # Stop the daemon
worklet daemon status # Check daemon statusThe daemon:
- Manages session registrations via Unix socket at
~/.worklet/worklet.sock - Enables automatic service discovery
- Persists session state across daemon restarts
Manage SSH credentials for use inside worklet containers.
worklet ssh setup # Copy SSH keys to Docker volume
worklet ssh status # Check SSH setup and test GitHub connectivityThis allows Git operations with private repositories to work seamlessly inside containers.
Clean up orphaned Docker resources from worklet sessions.
worklet cleanup # Clean up orphaned resources (preserves pnpm volumes)
worklet cleanup --force # Clean up ALL orphaned resourcesOpen a worklet session in VSCode using the Dev Containers extension.
worklet code # Open most recent session in VSCode
worklet code abc123 # Open specific session in VSCodeVSCode must be installed with the Dev Containers extension enabled.
Show version information for the worklet CLI and daemon.
worklet version # Show CLI and daemon versions
worklet daemon version # Show daemon version onlyRefresh session information to update service discovery.
worklet refresh # Refresh current session
worklet refresh abc123 # Refresh specific session
worklet refresh --all # Refresh all active sessionsList all active worklet sessions with their accessible DNS names.
worklet forks # List all active sessions with service URLs
worklet forks --debug # Show debug informationManage worklet project history and settings.
worklet projects list # List all projects in history
worklet projects clean # Clean up project history{
"name": "my-node-app",
"run": {
"image": "node:18",
"initScript": [
"npm install"
]
},
"services": [
{
"name": "app",
"port": 3000
}
]
}{
"name": "python-ml",
"run": {
"image": "python:3.11",
"environment": {
"PYTHONUNBUFFERED": "1"
},
"initScript": [
"pip install -r requirements.txt",
"python -m nltk.downloader punkt"
]
}
}{
"name": "microservices",
"services": [
{
"name": "frontend",
"port": 3000,
"subdomain": "app"
},
{
"name": "api",
"port": 8080,
"subdomain": "api"
},
{
"name": "admin",
"port": 3001,
"subdomain": "admin"
}
]
}{
"name": "compose-app",
"run": {
"image": "worklet/base:latest",
"composePath": "docker-compose.yml",
"credentials": {
"ssh": true
}
}
}{
"name": "private-project",
"run": {
"image": "node:18",
"credentials": {
"ssh": true, // Mount SSH for Git operations
"claude": true // Mount Claude for AI assistance
},
"initScript": [
"git config --global user.name 'Your Name'",
"git config --global user.email 'your@email.com'",
"npm install"
]
}
}# Start development with live reload
$ worklet run --mount npm run dev
# Your app is now running with:
# - Live code reloading
# - Full Docker-in-Docker support
# - Automatic service discovery
# Access your services:
# - http://app.my-project-12345.worklet.sh
# - http://api.my-project-12345.worklet.sh# Start a development session
$ worklet run --mount
# Open the session in VSCode
$ worklet code
# VSCode opens with:
# - Full Dev Containers integration
# - Your extensions automatically installed
# - Terminal connected to the container
# - Git integration working seamlessly# Run tests in isolated environment
$ worklet run npm test
# Run integration tests with Docker Compose
$ worklet run docker-compose run tests
# Run tests in temporary environment
$ worklet run --temp npm test# Test your CI pipeline locally
$ worklet run ./scripts/ci.sh
# Full isolation ensures no side effects
# See exactly what your CI server sees# One-time setup: configure SSH credentials
$ worklet ssh setup
# Check SSH is working
$ worklet ssh status
# Now your containers can clone private repos
$ worklet run git clone git@github.com:private/repo.gitAdd these to your shell configuration:
# Quick run commands
alias wr='worklet run'
alias wrm='worklet run --mount'
alias wrt='worklet run --temp'
# Terminal access
alias wt='worklet terminal'- Project Names: Set meaningful names in
.worklet.jsoncfor easier identification - Mount Mode: Use
--mountfor development, default mode for testing - Init Scripts: Keep them minimal for faster container startup
- Services: Define all exposed ports for automatic discovery
- Session Management: Use the interactive CLI (
worklet) to manage sessions - Cleanup: Run
worklet cleanupperiodically to remove orphaned resources - SSH Setup: Run
worklet ssh setuponce for seamless Git operations - VSCode: Use
worklet codefor a full IDE experience with containers
Worklet uses a client-server architecture:
- CLI: The main
workletcommand that users interact with - Daemon: Background process for service discovery and session management
- Terminal Server: Web-based terminal and proxy server
- Docker Integration: Manages containers with proper isolation
For advanced proxy configuration and service routing, see the nginx proxy setup documentation.
- Docker Desktop or Docker Engine
- macOS, Linux, or Windows with WSL2
- Go 1.21+ (for building from source)
Check Docker is running:
docker psEnsure your user is in the docker group:
sudo usermod -aG docker $USERCheck what's using the port:
lsof -i :3000Contributions are welcome! Please read our Contributing Guide for details.
Apache License 2.0. See the LICENSE file for details.
{ "name": "my-project", // Project name for container naming "run": { "image": "worklet/base:latest", // Base Docker image (default: worklet/base:latest) "privileged": true, // Run with Docker-in-Docker "isolation": "full", // "full" for DinD, "shared" for socket mount "command": ["/bin/sh"], // Default command (optional) "environment": { // Environment variables "NODE_ENV": "development", "DEBUG": "true" }, "volumes": [ // Additional volume mounts "/var/lib/mysql" ], "initScript": [ // Commands to run on container start "apk add --no-cache nodejs npm python3", "npm install -g pnpm", "echo 'Welcome to Worklet!'" ], "credentials": { "claude": true, // Mount Claude credentials if available "ssh": true // Mount SSH credentials for Git operations }, "composePath": "docker-compose.yml" // Path to docker-compose file (optional) }, "services": [ // Services exposed by your project { "name": "web", "port": 3000, "subdomain": "app" // Access via app.my-project.worklet.sh }, { "name": "api", "port": 3001, "subdomain": "api" // Access via api.my-project.worklet.sh } ] }