Docker 自定义路径 volume
使用命令形式
docker volume create –driver local -o o=bind -o type=none -o device=/dir volume_name
使用 docker-compose
volumes:
volume_name:
driver: local
driver_opts:
type:none
o: bind
device: /dir
例如:
volumes:
database:
driver: local
driver_opts:
type: none
o: bind
device: ./data/database # 绑定的本地文件夹
redis:
driver: local
driver_opts:
type: none
o: bind
device: ./data/redis # 绑定的本地文件夹