Skip to content

feat(run): inject secrets into Docker Compose services - #451

Open
vedgharat wants to merge 8 commits into
Infisical:mainfrom
vedgharat:feat/425-docker-compose-injection
Open

vedgharat wants to merge 8 commits into
Infisical:mainfrom
vedgharat:feat/425-docker-compose-injection

Conversation

@vedgharat

Copy link
Copy Markdown

Description 📣

Fixes Infisical/infisical#425.

Adds Docker Compose support to infisical run so fetched Infisical secrets are injected into every Compose service when running commands such as infisical run --env=dev -- docker compose up.

The implementation:

  • Supports docker compose up, docker-compose up, and nerdctl compose up.
  • Supports a single explicit --file/-f option and default Compose file discovery.
  • Writes a temporary Compose file beside the source file and removes it after execution.
  • Leaves the original Compose file unchanged.
  • Preserves explicit service-level environment values.
  • Handles both map-style and list-style environment sections.
  • Keeps non-Compose commands unchanged.

No new dependencies were required; the repository already includes gopkg.in/yaml.v3.

Type ✨

  • Bug fix
  • New feature
  • Improvement
  • Breaking change
  • Documentation

Tests 🛠️

Focused tests and the build pass. The full suite still has unrelated pre-existing failures in packages/util and test due to direct Resty construction checks, workspace migration fixtures, and missing required test environment variables.

go test ./packages/cmd ./packages/models
# PASS

go test ./packages/cmd -run 'TestPrepareComposeCommand' -count=1
# PASS

go build ./...
# PASS

git diff --check
# PASS

go test ./...
# FAIL: pre-existing packages/util and test package failures unrelated to this change

@greptile-apps

greptile-apps Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] The follow-up appears safe to merge.

Summary

Adds Docker Compose support to infisical run through a temporary override containing secret names rather than values.

  • Docker Compose services receive fetched secrets from infisical run.

Reviews (8) · Last reviewed commit: "test: strengthen compose injection cover..." · Reviewed by Greptile

Comment thread packages/cmd/run.go Outdated
Comment thread packages/cmd/compose.go Outdated
Comment thread packages/cmd/compose.go Outdated
Comment thread packages/cmd/compose.go Outdated
Comment thread packages/cmd/compose.go Outdated
Comment thread packages/cmd/compose.go
Comment thread packages/cmd/compose.go Outdated
Comment thread packages/cmd/compose.go Outdated
Comment thread packages/cmd/compose.go
Comment thread packages/cmd/compose_test.go Outdated
Comment thread packages/cmd/compose.go Outdated
Comment thread packages/cmd/compose.go Outdated
Comment thread packages/cmd/compose.go Outdated
@vedgharat

Copy link
Copy Markdown
Author

@greptileai review

Comment thread packages/cmd/compose_test.go
Comment thread packages/cmd/compose_test.go
Comment thread packages/cmd/compose.go
@greptile-apps

greptile-apps Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Want your agent to iterate on Greptile's feedback? Try greploops.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI Support for Injecting Envars into Docker-Compose Containers without embedding the CLI in Container Images

1 participant