I have not been able to find a way to define an environment level docker volume. external: false
gives me a stack scoped volume, and the documentation says I need to start the volume service I want to use, from the catalog, before I can create an environment scoped volume. However I can’t find a simple docker volume service. rancher-nfs requires I have an nfs export to connect to. I was thinking by making my database volume environment scoped, it will survive and accidental or intentional stack delete and rebuild. It does not seem to be as simple as just defining a volume at the environment level. Can anyone help me understand this? Thanks!
With experimentation I can see that specifying a local volume named ‘backups’ in my service definition seems to create an environment scoped volume, as it is named ‘backups’ (instead of -backups-) and my data was still accessible after deleting my stack that was using it and creating a new stack that connected to it. Defining ‘backups’ in the top level volumes section of my docker-compose file makes the volume stack scoped. I suspect I could also directly create a volume on my docker host named ‘backups’ for it to find so it won’t create a stack scoped one, but will need to try that. I am also going to look to override files as a possible solution to providing a local volume to say /tmp/stack/dev/backups and driver: rancher-nfs
for my stage and prod environments