How to set a path on host for a named volume in docker-compose.yml

后端 未结 3 1677
执笔经年
执笔经年 2020-12-02 08:08

Example below creates dbdata named volume and references it inside db service:

version: \'2\'
services:
  db:
    image: mysql
    volumes:         


        
3条回答
  •  情歌与酒
    2020-12-02 08:20

    The location of named volumes is managed by docker; if you want to specify the location yourself, you can either "bind mount" a host directory, or use a volume plugin that allows you to specify a path.

    You can find some details in another answer I posted recently; https://stackoverflow.com/a/36321403/1811501

提交回复
热议问题