私はそうのような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