我尝试为我的应用程序设置一个Docker-compose,其中包括基于nginx映像的服务。我想有可能仅从我的主机访问配置。但是当我用
挂载卷时 volumes:
- ./nginxConf:/etc/nginx
该卷为空,容器崩溃。
完整的docker-compose.yml
version: '3'
services:
frontend:
image: myFrontend
restart: always
environment:
- API_URL=http://localhost:3000/api/v1
ports:
- "80:80"
- "443:443"
depends_on:
- "api"
volumes:
- ./nginxConf:/etc/nginx
api:
image: myApi
restart: always
command: bash -c "npm run build && npm run start"
ports:
- "3000:3000"
links:
- mongo
depends_on:
- mongo
mongo:
container_name: mongo
image: mongo
ports:
- "27017:27017"