我对Docker并不陌生,现在已经有好几天了,现在设置docker-machine来通过使用卷在Windows pc上共享本地文件。
基本上,我使用github存储库作为支撑点https://github.com/koutsoumposval/laravel-microservices。我注意到,当我不使用docker-machine时,将使用docker-compose文件中的“ volumes”配置共享文件。
但是,当我在docker机器上托管相同的项目时,文件不会显示。当我SSH进入docker机器时,我可以看到顶层文件夹,但是它们都是空的。
我还可以通过使用Dockerfile中的'COPY'指令使本地文件显示在docker-machine中。但是我对此不太满意,因为对本地文件的更改不会自动反映在docker计算机中。
所以我的问题是我如何将本地文件与docker-machine同步,因为'volumes'目录显然无法正常工作。如果我以错误的方式考虑这个问题,也请指出正确的方向。
DOCKER-COMPOSE.YML
version: '3'
services:
proxy:
image: traefik
command: --web --docker --docker.domain=lm.local --docker.exposedbydefault=false --logLevel=DEBUG
networks:
- webgateway
ports:
- "80:80"
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /dev/null:/traefik.toml
order:
build:
context: order/php-apache
volumes:
- ../order:/var/www/html
labels:
- "traefik.enable=true"
- "traefik.frontend.rule=Host:order.lm.local"
- "traefik.backend=order"
networks:
- webgateway
- web
restart: always
user:
build:
context: user/php-apache
volumes:
- ../user:/var/www/html
labels:
- "traefik.enable=true"
- "traefik.frontend.rule=Host:user.lm.local"
- "traefik.backend=user"
networks:
- webgateway
- web
restart: always
inventory:
build:
context: inventory/php-apache
volumes:
- ../inventory:/var/www/html
labels:
- "traefik.enable=true"
- "traefik.frontend.rule=Host:inventory.lm.local"
- "traefik.backend=inventory"
networks:
- webgateway
- web
restart: always
api:
build:
context: api-gateway/php-apache
volumes:
- ../api-gateway:/var/www/html
labels:
- "traefik.enable=true"
- "traefik.frontend.rule=Host:api.lm.local"
- "traefik.backend=api"
networks:
- webgateway
- web
restart: always
networks:
webgateway:
driver: bridge
web:
external:
name: traefik_webgateway