When deploying a standalone container I can mount /dev/shm as a tmpfs with custom options as follows:
docker run --name my-container -v /dev/shm --tmpfs /dev/shm:rw,nosuid,nodev,exec,size=90g my-image
However, I cannot figure out how to do the same thing when deploying a container over a swarm using docker stack deploy
. There does not appear to be any relevant information in the documentation here. With the following docker-compose.yml
version: '3.6'
services:
master:
image: "my-image"
ports:
- "8080:8080"
volumes:
- type: tmpfs
target: /dev/shm
/dev/shm
is mounted with default options. How can I mount /dev/shm
with the options (rw,nosuid,nodev,exec,size=90g)
using docker stack deploy
?
Reading the docs here, --tmpfs can only be used with standalone containers, for services use --mount:
--tmpfs: Mounts a tmpfs mount without allowing you to specify any configurable options, and can only be used with standalone containers
Difference between --tmpfs and --mount described here:
The --tmpfs flag does not allow you to specify any configurable options.
The --tmpfs flag cannot be used with swarm services. You must use --mount.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With