Skip to content

store: remove the legacy docker namesgenerator dependency - #4169

Open
crazy-max wants to merge 1 commit into
docker:masterfrom
crazy-max:memorable-builder-names
Open

crazy-max wants to merge 1 commit into
docker:masterfrom
crazy-max:memorable-builder-names

Conversation

@crazy-max

@crazy-max crazy-max commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

This removes the remaining github.com/docker/docker dependency by replacing its pkg/namesgenerator package with golang-petname. Buildx has already migrated its client and API dependencies to the Moby modules, but generating random builder names still keeps the deprecated Docker module in its dependency graph and those of downstream consumers. The daemon CVEs reported in #3792 do not affect the naming code Buildx imports, as explained in #3792 (comment). This is dependency cleanup rather than a fix for a demonstrated Buildx vulnerability.

The change preserves memorable, two-word names and the existing underscore separator, using adjectives and animal-oriented names instead of notable people's surnames. Existing builders and explicitly supplied names are unaffected, and generation still makes up to six attempts to find an unused name in the local store. This retains names that are convenient to recognize, remember, and type without maintaining Buildx-specific word lists as proposed in #3354 or switching to opaque identifiers as proposed in #3813.

The generation logic itself is small. The reason for using an external module is to avoid taking ownership of another generator and its vocabulary, which was also a concern raised in #3354 (comment). Petname provides a small API and implementation, supports the existing separator directly, and has no external module dependencies. The selected word lists contain only lowercase ASCII letters, so generated names need no additional sanitization.

I compared several standalone Go generators and initially implemented fname. Its broader vocabulary provides more combinations, but I ultimately preferred petname's smaller implementation, dependency-free module, and established use in projects such as Terraform's random provider, LXD and PhotoPrism.

The pinned petname version provides 448 adjectives and 448 names, giving 200,704 two-word combinations. That compares with 25,487 initial combinations in the legacy Docker generator, excluding its numeric retry suffixes. This increases the initial name space without adding a third word or a mandatory numeric suffix.

Petname could also be evaluated independently by Moby as an optional name-generator extension alongside the discussion in moby/moby#52097. That would allow reuse of the same standalone library without duplicating word lists, but this PR does not depend on Moby adopting it or changing its default naming scheme.

AI-assisted with Codex for researching name-generator alternatives, implementing the change, and running validation. Claude Code provided an independent review.

@crazy-max
crazy-max force-pushed the memorable-builder-names branch from ea51ff6 to c42bb43 Compare October 22, 2026 12:16
@crazy-max crazy-max added this to the v0.39.0 milestone Oct 22, 2026
@crazy-max
crazy-max marked this pull request as ready for review October 23, 2026 09:07
Comment thread store/util.go Outdated

"github.com/docker/docker/pkg/namesgenerator"
"github.com/pkg/errors"
"github.com/splode/fname"

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.

do we really need a new dependency for this? Old code was ... 10 lines or so?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes the generation logic is small, agreed. What I'd like to avoid is maintaining another generator and its word lists ourselves, which was also a concern raised in #3354. That's why I went with a standalone external module rather than copying the implementation into Buildx. I'm not particularly attached to fname though, so if you have another lightweight module in mind, I'm open to it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I've switched this to golang-petname. It's smaller, has no external dependencies, and is already used by big projects like Terraform's random provider.

Replace the legacy Docker namesgenerator with golang-petname so builder
naming no longer requires the github.com/docker/docker module. Generate
two-word adjective and animal names while preserving underscore
separation and six attempts to find an unused name in the local store.

Use a standalone generator with no external dependencies instead of
maintaining Buildx-specific word lists.

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
@crazy-max crazy-max changed the title store: use fname to generate memorable builder names store: remove the legacy docker namesgenerator dependency Oct 23, 2026
@crazy-max
crazy-max force-pushed the memorable-builder-names branch from c42bb43 to 9734b78 Compare October 23, 2026 09:52

This branch has not been deployed

No deployments
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.

Migrate from github.com/docker/docker to github.com/moby/moby/client (v29 module path change)

2 participants