mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-22 07:11:01 +00:00
Implements the design captured in docs/adr/0001-docker-compose-profile-support.md (jesseduffield/lazydocker#423). Profiles render as pseudo-projects in the project panel; selecting one filters the services and containers panels to the services that activate with that profile, and Up/Down/Restart on the selection use docker compose --profile X invocations. Key choices: - Profile is a flag on Project (IsProfile bool), not a new type. Avoids a generic-type split across the SideListPanel and CommandObject. - Reuse existing command templates (Up, Down, DownWithVolumes, Restart, AllLogs, DockerComposeConfig). NewCommandObject appends --profile X when a profile context is set, so no separate UpProfile/DownProfile/... family is needed. Adds a new Restart template (master had no project-level restart at all). - Discovery via 'docker compose config --profiles' and 'docker compose --profile X config --services', cached on DockerCommand for the session. Soft-fails on error (logs once, caches empty) so the UI degrades to "no profile rows" rather than popping an error. - Per-profile service filtering uses the local project and the profile's service set (default services + profile-X services, per docker semantics). - No new keybinding for project/profile restart in this PR; handler exists for follow-up discussion. - New unit tests cover NewCommandObject --profile injection, GetProfiles caching, GetProfileServices caching, and the soft-fail path. fixes: https://github.com/jesseduffield/lazydocker/issues/423 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
160 lines
6 KiB
Markdown
160 lines
6 KiB
Markdown
# User Config:
|
|
|
|
## Opening The User Config
|
|
|
|
The location of the user config will differ depending on your OS. You can open it via lazydocker by opening the application, clicking on the 'project' panel at the top left and pressing 'o' (or pressing 'e' if your files open in vim).
|
|
|
|
Changes to the user config will only take place after closing and re-opening lazydocker
|
|
|
|
### Locations:
|
|
|
|
- OSX: `~/Library/Application Support/jesseduffield/lazydocker/config.yml`
|
|
- Linux: `~/.config/lazydocker/config.yml`
|
|
- Windows: `C:\Users\<User>\AppData\Roaming\lazydocker\config.yml`
|
|
|
|
JSON schema is available for `config.yml` so that IntelliSense in Visual Studio Code
|
|
(completion and error checking) is automatically enabled when the [YAML Red Hat][yaml]
|
|
extension is installed. However, note that automatic schema detection only works
|
|
if your config file is in one of the standard paths mentioned above. If you
|
|
override the path to the file, you can still make IntelliSense work by adding
|
|
|
|
```yaml
|
|
# yaml-language-server: $schema=https://json.schemastore.org/lazydocker.json
|
|
```
|
|
|
|
to the top of your config file or via [Visual Studio Code settings.json config][settings].
|
|
|
|
[yaml]: https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml
|
|
[settings]: https://github.com/redhat-developer/vscode-yaml#associating-a-schema-to-a-glob-pattern-via-yamlschemas
|
|
|
|
## Default:
|
|
|
|
```yml
|
|
gui:
|
|
scrollHeight: 2
|
|
language: "auto" # one of 'auto' | 'en' | 'pl' | 'nl' | 'de' | 'tr'
|
|
border: "rounded" # one of 'rounded' | 'single' | 'double' | 'hidden'
|
|
theme:
|
|
activeBorderColor:
|
|
- green
|
|
- bold
|
|
inactiveBorderColor:
|
|
- white
|
|
selectedLineBgColor:
|
|
- blue
|
|
optionsTextColor:
|
|
- blue
|
|
returnImmediately: false
|
|
wrapMainPanel: true
|
|
# Side panel width as a ratio of the screen's width
|
|
sidePanelWidth: 0.333
|
|
# Determines whether we show the bottom line (the one containing keybinding
|
|
# info and the status of the app).
|
|
showBottomLine: true
|
|
# When true, increases vertical space used by focused side panel,
|
|
# creating an accordion effect
|
|
expandFocusedSidePanel: false
|
|
# Determines which screen mode will be used on startup
|
|
screenMode: "normal" # one of 'normal' | 'half' | 'fullscreen'
|
|
# Determines the style of the container status and container health display in the
|
|
# containers panel. "long": full words (default), "short": one or two characters,
|
|
# "icon": unicode emoji.
|
|
containerStatusHealthStyle: "long"
|
|
logs:
|
|
timestamps: false
|
|
since: '60m' # set to '' to show all logs
|
|
tail: '' # set to 200 to show last 200 lines of logs
|
|
commandTemplates:
|
|
dockerCompose: docker compose # Determines the Docker Compose command to run, referred to as .DockerCompose in commandTemplates
|
|
restartService: '{{ .DockerCompose }} restart {{ .Service.Name }}'
|
|
up: '{{ .DockerCompose }} up -d'
|
|
down: '{{ .DockerCompose }} down'
|
|
downWithVolumes: '{{ .DockerCompose }} down --volumes'
|
|
restart: '{{ .DockerCompose }} restart'
|
|
upService: '{{ .DockerCompose }} up -d {{ .Service.Name }}'
|
|
startService: '{{ .DockerCompose }} start {{ .Service.Name }}'
|
|
stopService: '{{ .DockerCompose }} stop {{ .Service.Name }}'
|
|
serviceLogs: '{{ .DockerCompose }} logs --since=60m --follow {{ .Service.Name }}'
|
|
viewServiceLogs: '{{ .DockerCompose }} logs --follow {{ .Service.Name }}'
|
|
rebuildService: '{{ .DockerCompose }} up -d --build {{ .Service.Name }}'
|
|
recreateService: '{{ .DockerCompose }} up -d --force-recreate {{ .Service.Name }}'
|
|
allLogs: '{{ .DockerCompose }} logs --tail=300 --follow'
|
|
viewAlLogs: '{{ .DockerCompose }} logs'
|
|
dockerComposeConfig: '{{ .DockerCompose }} config'
|
|
checkDockerComposeConfig: '{{ .DockerCompose }} config --quiet'
|
|
serviceTop: '{{ .DockerCompose }} top {{ .Service.Name }}'
|
|
oS:
|
|
openCommand: open {{filename}}
|
|
openLinkCommand: open {{link}}
|
|
stats:
|
|
graphs:
|
|
- caption: CPU (%)
|
|
statPath: DerivedStats.CPUPercentage
|
|
color: blue
|
|
- caption: Memory (%)
|
|
statPath: DerivedStats.MemoryPercentage
|
|
color: green
|
|
```
|
|
|
|
## Docker Compose profiles
|
|
|
|
When a docker-compose profile is selected in the project panel, the project-scoped
|
|
templates (`up`, `down`, `downWithVolumes`, `restart`, `allLogs`, `viewAlLogs`,
|
|
`dockerComposeConfig`) automatically have `--profile <name>` appended via the
|
|
`{{ .DockerCompose }}` substitution. There are no separate profile templates
|
|
to configure — any custom override of those templates will pick up the profile
|
|
flag for free.
|
|
|
|
Selecting a profile row in the project panel also filters the services and
|
|
containers panels to the services that activate with that profile (default
|
|
services plus profile-tagged services, matching `docker compose --profile X
|
|
config --services`).
|
|
|
|
## To see what all of the config options mean, and what other options you can set, see [here](https://godoc.org/github.com/jesseduffield/lazydocker/pkg/config)
|
|
|
|
## Color Attributes:
|
|
|
|
For color attributes you can choose an array of attributes (with max one color attribute)
|
|
The available attributes are:
|
|
|
|
- default
|
|
- black
|
|
- red
|
|
- green
|
|
- yellow
|
|
- blue
|
|
- magenta
|
|
- cyan
|
|
- white
|
|
- bold
|
|
- reverse # useful for high-contrast
|
|
- underline
|
|
|
|
## Custom Commands
|
|
|
|
You can add custom commands like so:
|
|
|
|
```yaml
|
|
customCommands:
|
|
containers:
|
|
- name: bash
|
|
attach: true
|
|
command: 'docker exec -it {{ .Container.ID }} bash'
|
|
serviceNames: []
|
|
```
|
|
|
|
You may use the following go templates (such as `{{ .Container.ID }}` above) in your commands:
|
|
- `{{ .DockerCompose }}`: the docker compose command (default: `docker-compose`)
|
|
- [`{{ .Container }}`](https://pkg.go.dev/github.com/jesseduffield/lazydocker@v0.20.0/pkg/commands#Container) and its fields. For example: `{{ .Container.Container.ImageID }}`
|
|
- [`{{ .Service }}`](https://pkg.go.dev/github.com/jesseduffield/lazydocker@v0.20.0/pkg/commands#Service) and its fields. For example: `{{ .Service.Name }}`
|
|
|
|
## Replacements
|
|
|
|
You can add replacements like so:
|
|
|
|
```yaml
|
|
replacements:
|
|
imageNamePrefixes:
|
|
'123456789012.dkr.ecr.us-east-1.amazonaws.com': '<prod>'
|
|
'923456789999.dkr.ecr.us-east-1.amazonaws.com': '<dev>'
|
|
```
|