I want to know the equivalent of the configuration below to suit version 3 of docker-composer.yml! volumes_from is no longer valid so am I supposed to skip the data volume and replace it with top level volumes ?
version: '2'
services:
php:
build: ./docker-files/php-fpm/.
volumes_from:
- data
working_dir: /code
links:
- mysql
nginx:
image: nginx:latest
ports:
- "80:80"
volumes:
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
volumes_from:
- data
links:
- php
data:
image: tianon/true
volumes:
- .:/code
By default named volumes allow you to share data between containers. But it is some troubles with storing data in the same place on the host machine after restarting containers. But we can use local-persist docker plugin for fix it.
For migration to version 3 you need
1) install local-persist docker plugin (if you want to store volumes data to the particular place on the host machine)
2) modify
docker-compose.yml
Also you can store volumes data to the host machine with this volumes section:
But you can't specify path for this volume on host machine