testcontainers / testcontainers-python

Testcontainers is a Python library that providing a friendly API to run Docker container. It is designed to create runtime environment to use during your automatic tests.
https://testcontainers-python.readthedocs.io/en/latest/
Apache License 2.0
1.51k stars 281 forks source link

Add support for tmpfs mounts #316

Open gaby opened 1 year ago

gaby commented 1 year ago

Currently we are using tmpfs mounts with testcontainers-go to speed up bootstraping databases during CI. The data folder of the database gets mounted into a tmpfs mount which speeds up since disk i/o is avoided.

We have some components using python and noticed that testcontainers-python doesnt support tmpfs mounts.

PR for testcontainers-go here: https://github.com/testcontainers/testcontainers-go/pull/131

gaby commented 1 year ago

Ping @tillahoffmann

tillahoffmann commented 1 year ago

Sounds useful; open to contributions. You may be able to use with_kwargs in the meantime to mount a temporary file system.

rparme commented 1 month ago

To whoever is looking for how to do it with with_kwargs, here it is:

with_kwargs(
    tmpfs={"/var/lib/mysql": "rw"}
)

This sped up mysql:8.0 docker container start up by 3 or 4 for me

gaby commented 1 month ago

@rparme Thank you! 💪