Skip to content

feat(config): re-implement dbimage config option, mirroring webimage - #8610

Merged
rfay merged 2 commits into
ddev:mainfrom
rfay:20260721_rfay_reimplement_dbimage
Jul 30, 2026
Merged

rfay merged 2 commits into
ddev:mainfrom
rfay:20260721_rfay_reimplement_dbimage

Conversation

@rfay

@rfay rfay commented Jul 21, 2026

Copy link
Copy Markdown
Member

The Issue

There is no linked issue. While investigating why dbimage no longer works in config.yaml (it was removed from the DdevApp struct in #5274 back in 2023), we found that its sibling option, webimage, was kept as an unofficial, discouraged way to pin a custom container image. This PR restores the same capability for the db container, for parity.

How This PR Solves The Issue

  • Adds DBImage back to DdevApp (yaml:"dbimage,omitempty"), matching the existing WebImage field.
  • GetDBImage() now prefers an explicit DBImage override, falling back to the default computed from database type/version.
  • WriteConfig() strips dbimage back out when it matches the computed default, exactly as it already does for webimage.
  • Adds --db-image / --db-image-default flags to ddev config, mirroring --web-image / --web-image-default.
  • Adds the same "not recommended" discouragement comments to the generated config.yaml and to docs/content/users/configuration/config.md / docs/content/users/usage/commands.md.
  • Adds dbimage to pkg/ddevapp/schema.json.
  • As a related fix, ddev debug check-custom-config previously only detected custom files, with no notion of a customized config.yaml value. It now also flags non-default webimage/dbimage as custom configuration.

Manual Testing Instructions

  1. ddev config --project-type=php --docroot=web
  2. ddev config --db-image=ddev/ddev-dbserver-mariadb-11.8:v1.24.10 (pick any valid tag different from the project's default db image)
  3. Confirm .ddev/config.yaml has a dbimage: line with a "not recommended" comment above it.
  4. ddev start
  5. docker inspect <project>-db --format '{{.Config.Image}}' and confirm it matches the pinned tag (with a -<project>-built suffix).
  6. ddev debug check-custom-config should report the dbimage override under "Database" (and a webimage override, if set, under "Web server").
  7. ddev config --db-image-default should remove the line from config.yaml again.

Automated Testing Overview

  • pkg/ddevapp/config_test.go: TestReadConfig now asserts dbimage: is read from testdata/config.yaml into app.DBImage; TestNewConfig already exercises the default-image fallback via GetDBImage().
  • cmd/ddev/cmd/config_test.go: TestConfigSetValues now round-trips --db-image / --db-image-default through ddev config, matching the existing --web-image coverage.
  • cmd/ddev/cmd/utility-check-custom-config_test.go: new subtest verifies both webimage and dbimage overrides are reported by ddev debug check-custom-config.

Release/Deployment Notes

dbimage is intentionally undocumented as a "supported" feature — like webimage, it's an advanced/discouraged escape hatch that can break on DDEV upgrades if the pinned image diverges from what DDEV expects. No migration is needed; existing dbimage: lines in config.yaml (which have been silently ignored since 2023) will now take effect again.

@github-actions

github-actions Bot commented Jul 21, 2026 •

Copy link
Copy Markdown

@rfay

rfay commented Jul 21, 2026

Copy link
Copy Markdown
Member Author
ddev config --db-image=randyfay/prebuiltdb
ddev poweroff
ddev start 

ddev start shows custom config:

 ✔ Image randyfay/prebuiltdb Pulled                                                                         0.8s
Custom configuration detected in project 'd11':
  • Database: dbimage: randyfay/prebuiltdb (non-default)

Custom configuration is updated on restart. Run 'ddev restart' if changes don't take effect.
Add '#ddev-silent-no-warn' comment to files if you don't want to see these warnings.

@rfay
rfay requested a review from stasadev July 25, 2026 13:26
`dbimage`/`dbaimage` were removed from `DdevApp` in ddev#5274 (2023), while
`webimage` was kept as an unofficial, discouraged escape hatch for pinning
a custom container image. This restores the same capability for the db
container: `dbimage` in config.yaml, `--db-image`/`--db-image-default`
flags, the same "not recommended" comments, and default-stripping on write.

Non-default `webimage`/`dbimage` are also now flagged by
`ddev debug check-custom-config`, which previously only checked for
custom files and had no notion of customized config.yaml values.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MMiHJAL7r6z29tAWiqguhA
@stasadev
stasadev force-pushed the 20260721_rfay_reimplement_dbimage branch from ec6ebb9 to 356ffda Compare July 30, 2026 12:12
@stasadev
stasadev force-pushed the 20260721_rfay_reimplement_dbimage branch from 356ffda to cbcc136 Compare July 30, 2026 12:14

@stasadev stasadev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

I pushed one more commit to show the correct image in ddev version when it's run from within a project.

@rfay

rfay commented Jul 30, 2026

Copy link
Copy Markdown
Member Author

I pushed one more commit to show the correct image in ddev version when it's run from within a project.

Fantastic!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants