When using --tmpfs
in docker-run I can specify the maximum size (64M for a temporary folder may be ridiculously low depending on the usecase). However, apparently there is no way to do the same from a compose file.
@ThiefMaster this is already possible, you just use the mountpoint:options
format as with docker-run
Despite reading the doc, I concluded the same of @ThiefMaster .
Can we update the Compose File Reference section for 'tmpfs',
so this behavior is documented more clearly?
@ghost
can you give us an example?
Try docker-compose.yml
like this:
version: '2.1'
services:
test:
image: alpine
tmpfs:
- /tmp:size=1G
Test: docker-compose run test df | grep /tmp
this is certainly a better design than implemented in #5637. if someone added this to the reference docs for the appropriate versions, it would be great.
Can I use this syntax on Docker Swarm mode?
This seems to have been fixed somewhere along the line:
$ cat > 3339.yaml
version: '2.1'
services:
test:
image: alpine
tmpfs:
- /tmp:size=1G
$ docker-compose -f 3339.yaml run test df | grep /tmp
Creating network "compose_default" with the default driver
tmpfs 1048576 0 1048576 0% /tmp
$ docker-compose -f 3339.yaml run test df -h | grep /tmp
tmpfs 1.0G 0 1.0G 0% /tmp
Most helpful comment
Try
docker-compose.yml
like this:Test:
docker-compose run test df | grep /tmp