1
我见过泊坞量docker-compose.yml
文件,像这样的定义:泊坞窗匿名Voumes
-v /path/on/host/modules:/var/www/html/modules
我注意到Drupal's official image,他们docker-compose.yml
文件是使用anonymous volumes。
公告点评:
volumes:
- /var/www/html/modules
- /var/www/html/profiles
- /var/www/html/themes
# this takes advantage of the feature in Docker that a new anonymous
# volume (which is what we're creating here) will be initialized with the
# existing content of the image at the same location
- /var/www/html/sites
有没有一种方法,容器运行后,一位不愿意透露姓名的体积与主机上的路径相关联?如果不是,拥有匿名卷有什么意义?
全搬运工-compose.yml例如:
version: '3.1'
services:
drupal:
image: drupal:8.2-apache
ports:
- 8080:80
volumes:
- /var/www/html/modules
- /var/www/html/profiles
- /var/www/html/themes
# this takes advantage of the feature in Docker that a new anonymous
# volume (which is what we're creating here) will be initialized with the
# existing content of the image at the same location
- /var/www/html/sites
restart: always
postgres:
image: postgres:9.6
environment:
POSTGRES_PASSWORD: example
restart: always