docker-compose 多个服务共享卷

比如一个服务的assets,另一个nginx的服务要使用这些静态资源,如何共享?
Docker-compose-v3弃用volumes_from

Completely within Docker

  1. version: '3'
  2. services:
  3. nginx:
  4. volumes:
  5. - asset-volume:/var/lib/assets
  6. asset:
  7. volumes:
  8. - asset-volume:/var/lib/assets
  9. volumes:
  10. asset-volume:

使用宿主机

  1. version: '3'
  2. services:
  3. nginx:
  4. volumes:
  5. - ./assets:/var/lib/assets
  6. asset:
  7. volumes:
  8. - ./assets:/var/lib/assets

stackoverflow.com