Previously I used volumes_from to mount multiple volume locations to multiple containers, like so:
app:
image: mageinferno/magento2-nginx:1.11-1
links:
- phpfpm
volumes_from:
- appdata
ports:
- 8000:80
phpfpm:
image: mageinferno/magento2-php:7.0-fpm-1
links:
- db
volumes_from:
- appdata
appdata:
image: tianon/true
volumes:
- /var/www/html
- ~/.composer:/var/www/.composer
- ./html/app/code:/var/www/html/app/code
- ./html/app/design:/var/www/html/app/design
However, in docker-compose version 3 when using native volume mounts, volumes_from is not available, which leads me to do something like this:
version: "3"
services:
app:
image: mageinferno/magento2-nginx:1.11-1
links:
- phpfpm
volumes:
- appdata:/var/www/html
- ~/.composer:/var/www/.composer
- ./html/app/code:/var/www/html/app/code
- ./html/app/design:/var/www/html/app/design
ports:
- 8000:80
phpfpm:
image: mageinferno/magento2-php:7.0-fpm-1
links:
- db
volumes:
- appdata:/var/www/html
- ~/.composer:/var/www/.composer
- ./html/app/code:/var/www/html/app/code
- ./html/app/design:/var/www/html/app/design
Is there any way I can reference the same group of volume mounts to multiple services, without defining them twice?