Docker Builder Pro
Build Docker images for your project with one click, using client-based environment files.

Features
- One-Click Docker Builds: Build Docker images directly from VS Code
- Client-Based Environments: Support for multiple client configurations using environment files
- Docker Context Management: Automatic detection and switching of Docker contexts
- Build Script Support: Use custom build scripts or fall back to Docker CLI
- Project Configuration: Optional
.docker-builder-pro.json for project-specific settings
- Real-Time Logging: Stream build output to VS Code Output Channel
Requirements
- Docker Desktop or Docker Engine installed
- Docker CLI available in PATH
- Docker Compose (optional but recommended)
- VS Code 1.85.0 or higher
Installation
- Open VS Code
- Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
- Search for "Docker Builder Pro"
- Click Install
Or install from VSIX:
code --install-extension docker-builder-pro-1.0.0.vsix
Commands
Access commands via the Command Palette (Ctrl+Shift+P / Cmd+Shift+P):
Docker Builder Pro: Validate Docker Setup
Validates your Docker installation:
- Checks Docker CLI availability
- Checks Docker Compose availability
- Lists Docker contexts
- Detects context mismatches
- Offers automatic context switching
Docker Builder Pro: Build Image
Builds a Docker image with client-specific configuration:
- Detects project structure (Dockerfile, docker-compose.yml, .env.docker)
- Prompts for client name (e.g., "client1", "production")
- Prompts for version (default: v1.0.0)
- Creates client-specific environment file (.env.docker.client1)
- Executes build via script or Docker CLI
- Streams logs to Output Channel
Project Configuration
Create a .docker-builder-pro.json file in your project root:
{
"defaultEnv": ".env.docker",
"buildScript": "scripts/docker-build.ps1",
"dockerContext": "desktop-linux",
"tagPattern": "{client}-{version}"
}
Configuration Options
| Option |
Description |
Default |
defaultEnv |
Base environment file name |
.env.docker |
buildScript |
Path to custom build script |
scripts/docker-build.ps1 |
dockerContext |
Expected Docker context |
desktop-linux |
tagPattern |
Image tag pattern |
{client}-{version} |
dockerfile |
Dockerfile path |
Dockerfile |
composeFile |
Docker Compose file path |
docker-compose.yml |
Tag Pattern Placeholders
{client} - Client name from user input
{version} - Version from user input
Examples:
{client}-{version} → client1-v1.0.0
myapp-{client}-{version} → myapp-client1-v1.0.0
{client}/{version} → client1/v1.0.0
Build Script
If you have a custom build script at scripts/docker-build.ps1, the extension will use it:
# scripts/docker-build.ps1
param(
[Parameter(Mandatory=$true)]
[string]$EnvFile,
[Parameter(Mandatory=$true)]
[string]$Tag
)
Write-Host "Building Docker image: $Tag"
Write-Host "Using environment file: $EnvFile"
# Your custom build logic here
docker compose --env-file $EnvFile build
docker tag myapp:latest myapp:$Tag
Write-Host "Build complete!"
The extension calls the script with:
./scripts/docker-build.ps1 -EnvFile ".env.docker.client1" -Tag "client1-v1.0.0"
If no build script exists, the extension falls back to Docker CLI:
docker compose --env-file ".env.docker.client1" build
# or
docker build -t "client1-v1.0.0" .
VS Code Settings
Configure extension defaults in VS Code settings:
{
"dockerBuilderPro.defaultEnvFile": ".env.docker",
"dockerBuilderPro.defaultDockerContext": "desktop-linux",
"dockerBuilderPro.showOutputOnBuild": true
}
Project Structure Example
my-project/
├── .docker-builder-pro.json # Extension configuration
├── .env.docker # Base environment file
├── .env.docker.client1 # Generated client env file
├── Dockerfile # Docker build file
├── docker-compose.yml # Docker Compose file
├── scripts/
│ └── docker-build.ps1 # Custom build script
└── src/
└── ... # Your application code
Troubleshooting
Docker not found
Error: "Docker is not installed or not in PATH"
Solution:
- Install Docker Desktop from https://docker.com
- Ensure Docker is running
- Restart VS Code after installation
Context mismatch
Warning: "Docker context is 'default', expected 'desktop-linux'"
Solution:
- Click "Yes, Switch Context" when prompted
- Or manually run:
docker context use desktop-linux
Build script not found
If your build script isn't being detected:
- Ensure the script is at the path specified in config
- Default path is
scripts/docker-build.ps1
- Script must be executable
Permission denied (Linux/Mac)
Make your build script executable:
chmod +x scripts/docker-build.ps1
Output Channel
View detailed logs in the Output panel:
- Open Output panel (View → Output)
- Select "Docker Builder Pro" from dropdown
Development
Building from Source
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Watch for changes
npm run watch
# Package extension
npm run package
Project Architecture
docker-builder-pro/
├── src/
│ ├── extension.ts # Main entry point
│ ├── commands/
│ │ ├── validateDocker.ts # Validate command
│ │ └── buildImage.ts # Build command
│ ├── services/
│ │ ├── dockerService.ts # Docker CLI operations
│ │ ├── configService.ts # Configuration management
│ │ └── fileService.ts # File system operations
│ ├── utils/
│ │ ├── logger.ts # Logging utility
│ │ ├── executor.ts # Command execution
│ │ └── constants.ts # Constants
│ └── types/
│ └── index.ts # TypeScript interfaces
├── package.json
├── tsconfig.json
└── README.md
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature)
- Commit your changes (
git commit -m 'Add amazing feature')
- Push to the branch (
git push origin feature/amazing-feature)
- Open a Pull Request
License
MIT License - see LICENSE for details.