Reputation: 948
I have the following fragment of my yaml file.
version: '3'
services:
db:
image: dockerized_db
build: ./DB
volumes:
- pgdata:/var/lib/postgresql/data
ports:
- 5432:5432
volumes:
pgdata:
How can I define size of my volume in docker-compose file for that volume used by db container?
Upvotes: 2
Views: 8677
Reputation: 1707
The question is about docker-compose
, so you are able to set Docker volumes size quota within docker-compose driver opts as the following way:
volumes:
tmpfs:
driver: local
driver_opts:
o: "size=100m,uid=1000"
device: tmpfs
type: tmpfs
For details, please go to see https://docs.docker.com/engine/reference/commandline/volume_create/#driver-specific-options
Upvotes: 2
Reputation: 2754
You can create a volume with a size limit and attach it to the container, a good example you can find here
The following example creates a tmpfs volume called foo with a size of 100 megabytes and uid of 1000.
docker volume create --driver local \
--opt type=tmpfs \
--opt device=tmpfs \
--opt o=size=100m,uid=1000 \
foo
Upvotes: 1