我有以下要在主机网络上构建的 docker-compose 文件。构建成功,但构建后我无法看到任何结果。
version: "3.3"
services:
mycontainer_3000:
container_name: mycontainer_3000
build:
context: src/mycontainer_3000
dockerfile: ./../../Dockerfile.dev
args:
- T_ENV
image: myproject/mycontainer_3000:latest
restart: unless-stopped
network_mode: host
volumes:
- "./src/mycontainer_3000:/usr/src/app"
depends_on:
- mycontainer_3001
mycontainer_3001:
container_name: mycontainer_3001
build:
context: src/mycontainer_3001
dockerfile: ./../../Dockerfile.dev
args:
- T_ENV
image: myproject/mycontainer_3001:latest
volumes:
- "./src/mycontainer_3001:/usr/src/app"
depends_on:
- mongo
mycontainer_3003:
container_name: mycontainer_3003
build:
context: src/mycontainer_3003
dockerfile: ./../../Dockerfile.dev
args:
- T_ENV
image: myproject/mycontainer_3003:latest
network_mode: host
volumes:
- "./src/mycontainer_3003:/usr/src/app"
depends_on:
- mongo
mycontainer_3002:
container_name: mycontainer_3002
build:
context: src/mycontainer_3002
dockerfile: ./../../Dockerfile.dev
args:
- T_ENV
image: myproject/mycontainer_3002:latest
network_mode: host
volumes:
- "./src/mycontainer_3002:/usr/src/app"
mongo:
image: mongo
restart: always
network_mode: host
volumes:
- "./db/:/data/db"
mongo-express:
image: mongo-express
restart: always
network_mode: host
environment:
ME_CONFIG_MONGODB_URL: mongodb://mongo:27017/
当我使用 编译时docker-compose up,所有容器都已成功创建。但是当我尝试使用 http://localhost:3000 或任何其他端口访问任何容器时,它显示该端口上没有运行任何东西!