Skip to content

customization of volumes and advanced docker option is not allowed #332

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Donemmanuelo opened this issue Apr 30, 2025 · 3 comments
Open

Comments

@Donemmanuelo
Copy link

when it comes to using testcontainers-modules for different modulus foeinstance postgres module, it's practically impossible to carry out a real integration test for postgres data persistency, because each integration test uses a different database instance, thus all data stored in it is drop when the database is stopped making it tedious to check data persistency, but however using volumes and advanded docker option allow us to:

  • Mounts a volume at /var/lib/module/data, which is where module stores its data.

  • That means data written to the DB is stored in the mounted directory (/tmp/module_data_test), not lost with the container lifecycle.

@DDtKey
Copy link
Contributor

DDtKey commented May 1, 2025

Hi @Donemmanuelo 👋

Perhaps I misunderstood something, but some quick answers:

  • Testcontainers support volumes configuration via with_mount - you can override this as you wish

  • What do you mean by "advanced docker option"? ImageExt allows to customize quite a lot of options

    • JFYI: you don't need to depend on the core crate, it's re-exported

@Donemmanuelo
Copy link
Author

Hello @DDtKey

The advanced docker option i was talking about was the bind mount: Persistent data, sharing config files, cache

reuse, though never stated in your documentation, named volumes: Useful if you want Docker to manage

volume lifecycle and the Network modes : Sometimes needed for simulating host network behavior or

debugging, which are not supported, in the exception of bind mount supported by the use of with_mount().

@DDtKey
Copy link
Contributor

DDtKey commented May 1, 2025

Could you point me to particular docker feature you're missing? (so we will be able to track each of them separately if any)

  • "bind mount" is supported as mentioned above
  • "named volumes" are supported as part if with_mount: see volume_mount
  • "the Network modes": currently we support only specifying of the network name via with_network.
    You can use .with_network("host")

In addition to that, we expose the pre-configured Docker client: docker_client_instance if you have some specific needs on top of the current functionality

__
Also, pay attention that testcontainers-modules is just a collection of pre-cooked images. The core crate is testcontainers (repo)

So if you have particular question/suggestion related to the core functionallity - it's better to create an issue there

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

No branches or pull requests

2 participants