Testcontainers-java: Add first-class support for configuring tmpfs

Created on 1 May 2018  路  5Comments  路  Source: testcontainers/testcontainers-java

Since docker-java added support for tmpfs in 3.1.0-rc-3 (see docker-java/docker-java#1022), it is now possible to configure TestContainers to use tmpfs using something like:

withCreateContainerCmdModifier(cmd -> cmd.getHostConfig().withTmpFs(
        Collections.singletonMap(System.getProperty("java.io.tmpdir"), "rw")));

It would be nice if TestContainers could enhance it's API to provide a way to configure this a bit simpler.

good first issue hacktoberfest resolutioacknowledged typfeature

Most helpful comment

How about this solution? Is it okay?
new GenericContainer().withTmpFs(singletonMap("/path", "rw")

All 5 comments

Hi @vpavic,

That's indeed something we could add 馃憤

FYI @rnorth was experimenting with TmpFS but the results were not that impressive back then if I remember correctly.

We use TmpFs for some time now on Apache James project and the gain is huge.

Let's give it a go again! It's not hard to do, so fair to add it for teams that will benefit.

How about this solution? Is it okay?
new GenericContainer().withTmpFs(singletonMap("/path", "rw")

Released in 1.10.4!

Thanks for the contribution!

Was this page helpful?
0 / 5 - 0 ratings