Reputation: 668
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?
Upvotes: 4
Views: 3952
Reputation: 9968
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
Upvotes: 3
Reputation: 1350
You can view the Docker compose volume spec of docker compose version 3.
You can specify the driver and driver_opts under the volume section.
For example, volume section will look like :
volumes:
example:
driver_opts:
type: "nfs"
Upvotes: 1
Reputation: 158908
Go ahead and use version: '2.4'
in your docker-compose.yml
file.
Version 3's options are a little more oriented towards Docker's Swarm cluster manager. Several of the version 2 options, especially around resource settings, are removed in version 3, and then put into a deploy:
block which is ignored in non-Swarm mode.
Version 2 is still fully supported by all versions of the docker-compose
tool, and if you need version 2 options then the recommended approach is to use a version 2 Compose file.
Upvotes: 0