Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set the storage options in docker-compose v3?

Docker Compose version 2 has a store_opts key. Docker compose 3 does not.

https://docs.docker.com/compose/compose-file/compose-file-v2/

I want to set the storage options of docker-compose to use the inmemory driver, because I'm using docker-compose for unit testing a database. How can I set the storage driver in docker-compose v3?

like image 923
Rol Avatar asked Nov 15 '25 01:11

Rol


1 Answers

If you are looking to set inmemory, you can use type: tmpfs with driver_opts and mount it to your container:

version: '3'
services:
    database:
        image: postgres
        tty: true
        ports:
          - "5432"
        volumes:
          - "mypartition:/path/to/my/partition"
          - "/your/custom/path:/any/other/location"
volumes:
    mypartition:
      driver_opts:
        type: tmpfs
        o: "size=2g"
        device: tmpfs
like image 92
richyen Avatar answered Nov 17 '25 20:11

richyen