Verified Production Fix
[docker/cli] Add support for `docker (compose) run/up` presets like `docker buildx bake`
GH-docker/cli#6271 • Mar 07, 2026
### ROOT CAUSE
The current Docker Compose CLI does not support a preset system for running or starting containers in a declarative manner, limiting flexibility for users with multiple configurations.
### CODE FIX
To address the issue of adding preset support for `docker compose run/up` similar to `docker buildx bake`, we propose introducing a new `docker runpreset` command. This command will read configuration from a preset file and execute the specified targets with their options.
**Proposed Fix:**
1. **Introduce `docker runpreset` Command:**
Add a new command `docker runpreset` that reads a preset file and runs the specified targets.
2. **Preset File Format:**
Create a JSON file (e.g., `docker-runpreset.json`) containing targets and their configurations.
**Example `docker-runpreset.json`:**
json
{
"version": "1.0.0",
"presets": {
"dev": {
"services": ["api", "db"],
"options": {
"api": {
"--env": ["NODE_ENV=development"],
"--ports": ["3000:3000"]
}
}
},
"test": {
"services": ["api"],
"options": {
"api": {
"--env": ["NODE_ENV=test"],
"--ports": ["3001:3000"],
"--volume": ["./test:/app/test"]
}
}
}
}
}
**Command Usage:**
bash
docker runpreset -f docker-runpreset.json dev
docker runpreset -f docker-runpreset.json test --env ADDITIONAL_ENV=var
**Code Changes:**
- **Add `docker runpreset` Command:**
Implement the new command to parse the preset file and execute targets.
**Note:** The implementation would involve adding the necessary parsing logic and command handling in the Docker CLI.
This fix introduces a flexible preset system for running Docker containers, enhancing usability for users with multiple environments.
Deploy with Vultr
Use this fix in production instantly. Claim your high-performance developer credit.
Get Started with Vultr →
digital