Skip to content

Conversation

@dfioravanti
Copy link
Contributor

What does this PR do?

The generic container allows to set a provider for a container but this is not exposed via the options. This commit adds this capability so that it is possible to set the provider to Podman on MacOS when the auto detection fails

Why is it important?

It is part of what allows using Ryuk on MacOS. One still has to set the VM to run rootless but without this change even with root it does not work because the wrong network is detected

Related issues

@dfioravanti dfioravanti requested a review from a team as a code owner July 24, 2025 02:51
@netlify
Copy link

netlify bot commented Jul 24, 2025

Deploy Preview for testcontainers-go ready!

Name Link
🔨 Latest commit 77f7b36
🔍 Latest deploy log https://app.netlify.com/projects/testcontainers-go/deploys/68873d8c3b194c000845aa48
😎 Deploy Preview https://deploy-preview-3241--testcontainers-go.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@mdelapenya
Copy link
Member

mdelapenya commented Jul 24, 2025

@dfioravanti thanks for this. I mentioned that we are working on the Docker SDK, so the concept of Provider will be automatically discarded with that (the SDK simply uses the current docker context to get a docker client), so the configuration would be much much easier, so I'd say that this PR won't be not needed.

On the other hand, thanks to the functional options pattern, this new option is harmless, so it's fine for me adding it and let users of the library choose.

Said that, could you please check if the podman docs are up-to-date with these changes? 🙏

@dfioravanti dfioravanti force-pushed the feat/add_with_provider_option branch from 6e1e7fd to 15549c6 Compare July 25, 2025 03:02
@dfioravanti
Copy link
Contributor Author

@mdelapenya thanks for been open to merge this

Said that, could you please check if the podman docs are up-to-date with these changes? 🙏

I updated the documentation and added the option to the list of options. Does it work now?

Copy link
Member

@mdelapenya mdelapenya left a comment

Choose a reason for hiding this comment

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

Just a couple of refinements, other than that, LGTM

The generic container allows to set a provider for a container but this
is not exposed via the options. This commit adds this capability so that
it is possible to set the provider to Podman on MacOS when the auto
detection fails
@dfioravanti dfioravanti force-pushed the feat/add_with_provider_option branch from 15549c6 to 3bb3f06 Compare July 26, 2025 09:40
@dfioravanti
Copy link
Contributor Author

@mdelapenya I fixed the two problems, thanks for the review

mdelapenya
mdelapenya previously approved these changes Jul 28, 2025
Copy link
Member

@mdelapenya mdelapenya left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@mdelapenya mdelapenya self-assigned this Jul 28, 2025
@mdelapenya mdelapenya added the enhancement New feature or request label Jul 28, 2025
@mdelapenya mdelapenya requested a review from Copilot July 29, 2025 15:26
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new WithProvider option to allow users to explicitly specify which container provider (Docker or Podman) to use when creating containers. This addresses issues with provider auto-detection, particularly on MacOS where Podman detection fails and prevents Ryuk from working properly.

  • Introduces WithProvider function that accepts a ProviderType parameter
  • Adds comprehensive test coverage for the new option with all supported provider types
  • Updates documentation with MacOS-specific guidance for using Podman with Ryuk

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
options.go Implements the new WithProvider function that sets the provider type on container requests
options_test.go Adds comprehensive test coverage for the WithProvider option with all provider types
docs/system_requirements/using_podman.md Documents MacOS-specific setup instructions for using Podman with Ryuk
docs/features/common_functional_options_list.md Adds the new option to the options list with version information
docs/features/common_functional_options.md Documents the WithProvider option with usage description
Comments suppressed due to low confidence (1)

@mdelapenya mdelapenya added the podman Issues regarding podman. label Jul 29, 2025
@mdelapenya mdelapenya merged commit f5c1309 into testcontainers:main Jul 29, 2025
206 checks passed
mdelapenya added a commit that referenced this pull request Jul 31, 2025
…util/v4-4.25.6

* main:
  fix(dockermcpgateway): use duckduckgo instead of brave (#3247)
  feat: add Solace pubsub+ module (#3230)
  feat(options): add WithProvider (#3241)
  chore(deps): bump github/codeql-action from 3.29.2 to 3.29.3 (#3237)
  chore(deps): bump golang.org/x/oauth2 in /modules/weaviate (#3240)
  chore(deps): bump mkdocs-include-markdown-plugin from 7.1.5 to 7.1.6 (#3239)
  chore(deps): bump requests from 2.32.0 to 2.32.4 (#3204)
  feat(mcpgateway): add MCP gateway module (#3232)
  chore(deps): bump golang.org/x/oauth2 in /modules/pulsar (#3236)
  chore(deps): bump golang.org/x/oauth2 in /modules/gcloud (#3235)
  chore(deps): bump golang.org/x/oauth2 in /modules/k3s (#3234)
  chore: prepare for next minor development cycle (0.39.0)
  chore: use new version (v0.38.0) in modules and examples
  Update go.mod in azure module (#3231)
  fix: strip headers from logs using log stream specification  (#3226)
  chore: clarify image auth warning message for public images (#3228)
  chore(deps): bump github.com/go-viper/mapstructure/v2 (#3219)
  chore(deps): bump github/codeql-action from 3.28.16 to 3.29.2 (#3222)
  chore(deps): bump mkdocs-include-markdown-plugin from 7.1.5 to 7.1.6 (#3225)
mdelapenya added a commit to knqyf263/testcontainers-go that referenced this pull request Sep 5, 2025
* main: (33 commits)
  feat(registry): add helper functions to pull and tag images (testcontainers#3275)
  fix(reaper): remove termSignal override (testcontainers#3261)
  chore(deps): bump ryuk to v0.13.0, which uses scratch as base image (testcontainers#3274)
  chore(release): refine release script to update inter-module dependencies (testcontainers#3273)
  fix(registry): update `WithHtpasswd` to use `os.CreateTemp` instead of `os.Create` with `filepath.Join`. (testcontainers#3272)
  chore(deps): bump github.com/docker/docker from 28.2.2+incompatible to 28.3.3+incompatible (testcontainers#3270)
  chore(postgres): use require.NotNil instead of assert.NotNil (testcontainers#3252)
  fix(nats): use wait for listening port instead of wait for log (testcontainers#3256)
  chore(deps): bump github.com/go-viper/mapstructure/v2 (testcontainers#3267)
  fix(postgres): snapshot restore (testcontainers#3264)
  fix(dockermcpgateway): use duckduckgo instead of brave (testcontainers#3247)
  feat: add Solace pubsub+ module (testcontainers#3230)
  feat(options): add WithProvider (testcontainers#3241)
  chore(deps): bump github/codeql-action from 3.29.2 to 3.29.3 (testcontainers#3237)
  chore(deps): bump golang.org/x/oauth2 in /modules/weaviate (testcontainers#3240)
  chore(deps): bump mkdocs-include-markdown-plugin from 7.1.5 to 7.1.6 (testcontainers#3239)
  chore(deps): bump requests from 2.32.0 to 2.32.4 (testcontainers#3204)
  feat(mcpgateway): add MCP gateway module (testcontainers#3232)
  chore(deps): bump golang.org/x/oauth2 in /modules/pulsar (testcontainers#3236)
  chore(deps): bump golang.org/x/oauth2 in /modules/gcloud (testcontainers#3235)
  ...
mdelapenya added a commit to mdelapenya/testcontainers-go that referenced this pull request Sep 5, 2025
* main: (30 commits)
  fix: preserve unix socket schema in testcontainers host from properties (testcontainers#3213)
  feat(registry): add helper functions to pull and tag images (testcontainers#3275)
  fix(reaper): remove termSignal override (testcontainers#3261)
  chore(deps): bump ryuk to v0.13.0, which uses scratch as base image (testcontainers#3274)
  chore(release): refine release script to update inter-module dependencies (testcontainers#3273)
  fix(registry): update `WithHtpasswd` to use `os.CreateTemp` instead of `os.Create` with `filepath.Join`. (testcontainers#3272)
  chore(deps): bump github.com/docker/docker from 28.2.2+incompatible to 28.3.3+incompatible (testcontainers#3270)
  chore(postgres): use require.NotNil instead of assert.NotNil (testcontainers#3252)
  fix(nats): use wait for listening port instead of wait for log (testcontainers#3256)
  chore(deps): bump github.com/go-viper/mapstructure/v2 (testcontainers#3267)
  fix(postgres): snapshot restore (testcontainers#3264)
  fix(dockermcpgateway): use duckduckgo instead of brave (testcontainers#3247)
  feat: add Solace pubsub+ module (testcontainers#3230)
  feat(options): add WithProvider (testcontainers#3241)
  chore(deps): bump github/codeql-action from 3.29.2 to 3.29.3 (testcontainers#3237)
  chore(deps): bump golang.org/x/oauth2 in /modules/weaviate (testcontainers#3240)
  chore(deps): bump mkdocs-include-markdown-plugin from 7.1.5 to 7.1.6 (testcontainers#3239)
  chore(deps): bump requests from 2.32.0 to 2.32.4 (testcontainers#3204)
  feat(mcpgateway): add MCP gateway module (testcontainers#3232)
  chore(deps): bump golang.org/x/oauth2 in /modules/pulsar (testcontainers#3236)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request podman Issues regarding podman.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants