A Sublime Text 4 plugin that brings VS Code's devcontainer functionality to Sublime Text, with full LSP (Language Server Protocol) support for intelligent code editing inside containers.
- 📦 Full devcontainer.json Support - Compatible with VS Code's devcontainer specification
- 🐳 Docker & Podman Support - Works with both Docker and Podman container runtimes
- 🔌 LSP Integration - Automatic LSP server configuration and management in containers
- 🚀 Quick Start - Start, stop, and attach to containers with simple commands
- 🔄 Auto-configuration - Automatically detects and configures development environments
- 📝 Template Support - Create new devcontainer.json files with templates
- 🔧 Docker Compose Support - Works with multi-container setups
- Sublime Text 4 (build 4000+)
- Docker or Podman installed and running
- LSP package (for language server support)
- Open Command Palette (
Ctrl+Shift+P/Cmd+Shift+P) - Select
Package Control: Install Package - Search for
DevContainer - Press Enter to install
-
Clone this repository to your Sublime Text Packages directory:
cd ~/.config/sublime-text/Packages git clone https://github.com/yourusername/sublime-devcontainer DevContainer
-
Restart Sublime Text
If your project already has a .devcontainer/devcontainer.json or .devcontainer.json file:
- Open the project folder in Sublime Text
- Open Command Palette
- Run
DevContainer: Start - Wait for the container to build and start
- Run
DevContainer: Attachto connect to the container
For projects without devcontainer configuration:
- Open Command Palette
- Run
DevContainer: Edit Config - Select where to create the file (
.devcontainer/devcontainer.jsonor.devcontainer.json) - Edit the generated configuration
- Run
DevContainer: Start
Access settings via Preferences > Package Settings > DevContainer > Settings
{
// Container runtime: "docker", "podman", or null for auto-detect
"container_runtime": null,
// Compose command: "docker-compose", "podman-compose", or null
"compose_command": null,
// Auto-start containers when opening projects
"auto_start": false,
// Clean up containers on exit
"clean_on_exit": false,
// LSP integration
"lsp": {
"auto_configure": true,
"default_servers": {
"python": ["pyright", "ruff"],
"javascript": ["typescript-language-server"],
"rust": ["rust-analyzer"]
}
}
}Simple Python Development:
{
"name": "Python Dev Container",
"image": "mcr.microsoft.com/devcontainers/python:3.11",
"customizations": {
"sublimetext": {
"extensions": ["LSP-pyright", "LSP-ruff"],
"settings": {}
}
},
"forwardPorts": [8000],
"postCreateCommand": "pip install -r requirements.txt"
}Node.js with Docker Compose:
{
"name": "Node.js App",
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspace",
"customizations": {
"sublimetext": {
"extensions": ["LSP-typescript"]
}
},
"forwardPorts": [3000],
"postCreateCommand": "npm install"
}Custom Dockerfile:
{
"name": "Custom Dev Environment",
"build": {
"dockerfile": "Dockerfile",
"context": ".",
"args": {
"NODE_VERSION": "18"
}
},
"customizations": {
"sublimetext": {
"extensions": []
}
},
"forwardPorts": [8080],
"remoteUser": "developer"
}Access via Command Palette (Ctrl+Shift+P / Cmd+Shift+P):
- DevContainer: Start - Start the development container
- DevContainer: Stop - Stop the running container
- DevContainer: Attach - Attach to a running container with LSP support
- DevContainer: Edit Config - Create or edit devcontainer.json
- DevContainer: Exec - Execute a command in the container
- DevContainer: Logs - View plugin logs
- DevContainer: Stop All - Stop all containers started by this plugin
- DevContainer: Remove All - Remove all containers and cleanup
The plugin automatically:
- Installs LSP servers in containers based on detected languages
- Configures the LSP package to communicate with containerized servers
- Maps file paths between your local workspace and container
- Python: pyright, pylsp, ruff-lsp
- JavaScript/TypeScript: typescript-language-server
- Rust: rust-analyzer
- Go: gopls
- C/C++: clangd
- Ruby: solargraph
- Java: jdtls
In devcontainer.json:
{
"customizations": {
"sublimetext": {
"extensions": ["LSP-pyright", "LSP-ruff"],
"settings": {
"LSP": {
"pyright": {
"settings": {
"python.analysis.typeCheckingMode": "strict"
}
}
}
}
}
}
}Automatically forward ports from container to host:
{
"forwardPorts": [3000, 8080],
"portsAttributes": {
"3000": {
"label": "Frontend"
},
"8080": {
"label": "Backend API"
}
}
}Set environment variables in the container:
{
"containerEnv": {
"DATABASE_URL": "postgresql://localhost/devdb",
"DEBUG": "true"
},
"remoteEnv": {
"PATH": "${containerEnv:PATH}:/custom/bin"
}
}Install additional tools using devcontainer features:
{
"features": {
"ghcr.io/devcontainers/features/git:1": {
"version": "latest"
},
"ghcr.io/devcontainers/features/node:1": {
"version": "18"
}
}
}Run commands at different stages:
{
"postCreateCommand": "npm install && npm run build",
"postStartCommand": "npm run dev",
"postAttachCommand": "git status"
}This plugin is inspired by nvim-dev-container but adapted for Sublime Text:
| Feature | nvim-dev-container | sublime-devcontainer |
|---|---|---|
| Container Support | ✅ Docker/Podman | ✅ Docker/Podman |
| devcontainer.json | ✅ Full support | ✅ Full support |
| LSP Integration | ✅ Native nvim LSP | ✅ Via LSP package |
| Auto-start | ✅ | ✅ |
| Compose Support | ✅ | ✅ |
| Features Support | ||
| UI Integration | Neovim terminal | Sublime terminal |
- Check Docker/Podman is running:
docker psorpodman ps - View plugin logs: Run
DevContainer: Logs - Verify devcontainer.json syntax
- Check container runtime in settings
- Ensure LSP package is installed
- Check container is running:
DevContainer: Attach - Verify LSP servers are installed in container
- Check LSP logs:
Tools > LSP > Troubleshoot Server
The plugin automatically maps paths between local workspace and container. If you encounter issues:
- Check
workspaceMountin devcontainer.json - Verify
workspaceFolderis correct - Ensure workspace folder is mounted correctly
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
sublime-devcontainer/
├── devcontainer.py # Main plugin code
├── lsp_helper.py # LSP integration
├── DevContainer.sublime-settings # Default settings
├── package-metadata.json # Package Control metadata
└── README.md # This file
Test the plugin with various devcontainer configurations:
# Python project
cd test-projects/python
subl .
# Node.js project
cd test-projects/nodejs
subl .
# Multi-container project
cd test-projects/fullstack
subl .- Dev Container Specification
- VS Code DevContainers Documentation
- Sublime LSP Package
- nvim-dev-container - Inspiration for this plugin
MIT License - see LICENSE file for details
- Inspired by nvim-dev-container
- Built on the Dev Container Specification
- Uses Sublime LSP for language server support
- 📝 Report Issues
- 💬 Discussions
- 📧 Email: your.email@example.com