Configuration
Customize StackMark behavior and manage your stacks configuration.
Configuration File
StackMark stores its configuration in ~/.stackmark/config.json. This file is created automatically when you first use StackMark.
Location
| Platform | Path |
|---|---|
| Linux | ~/.stackmark/config.json |
| macOS | ~/.stackmark/config.json |
| Windows | %USERPROFILE%\.stackmark\config.json |
Structure
{
"portStart": 9000,
"stacks": {
"myapp": {
"path": "/home/user/Dev/myapp",
"domain": "myapp.local",
"ports": {
"nginx": 9003,
"mysql": 9004,
"redis": 9005
}
},
"api-project": {
"path": "/home/user/Dev/api",
"ports": {
"node": 9010,
"postgres": 9011
}
}
}
}
Configuration Options
portStart
The starting port number for automatic port allocation. Default: 9000
StackMark allocates ports sequentially starting from this number. Each service in each stack gets a unique port.
stacks
Object containing all registered stacks. Each stack has:
| Property | Description |
|---|---|
path |
Absolute path to the docker-compose.yml directory |
domain |
Optional local domain for /etc/hosts |
ports |
Map of service names to allocated external ports |
Port Allocation
StackMark automatically allocates ports to avoid conflicts between stacks.
How It Works
- When you
stackmark adda project, StackMark scans docker-compose.yml - For each service with exposed ports, it allocates the next available port starting from
portStart - Port mappings are stored in the config file
- When starting a stack, a temporary override file remaps the ports
Example
services:
nginx:
ports:
- "80:80"
mysql:
ports:
- "3306:3306"
Your original docker-compose.yml is never modified. StackMark creates temporary override files at runtime.
Environment Variables
Configure StackMark behavior using environment variables:
| Variable | Description | Default |
|---|---|---|
STACKMARK_CONFIG_DIR |
Override config directory location | ~/.stackmark |
STACKMARK_PORT_START |
Override starting port number | 9000 |
DOCKER_COMPOSE_CMD |
Docker Compose command to use | docker compose |
Manual Configuration
You can edit the config file directly to:
- Change port assignments
- Add or modify domains
- Update stack paths
Reset Configuration
To reset StackMark to default settings:
Warning: This will remove all registered stacks. You'll need to re-add them with stackmark add.