Is it possible to use tmpfs for services/volumes?

I would be interested in something like this:

services:
  mongo:
    image: mongo:3.2
    command: [ --smallfiles ]
    tmpfs: /data/db

This is possible with docker and docker compose like described here: https://blog.sneawo.com/blog/2017/01/26/fast-tests-with-in-memory-mongodb/

I will answer myself with a workaround I made:

services:
  mongo:
    image: rushpl/mongo-tmpfs:3.2
    privileged: true

We merged a patch 2 weeks ago that includes support for tmpfs, for trusted repositories. It is included in 0.8-rc.5. Reference pull request https://github.com/cncd/pipeline/pull/22

services:
  mongo:
    image: mongo
    tmpfs: /data/db
1 Like

Nice work, looks like 0.8 will be a great release.