我试图在windows 10上启动带有的应用程序,并连接到运行在同一台机器上的MongoDB 3.4。命令启动应用程序:docker-compose -f src/main/docker/app.yml up
我有一个应用程序是由jhipster和这个docker配置生成的:
version: '2'
services:
core-app:
image: core
environment:
- SPRING_PROFILES_ACTIVE=prod,swagger
- EUREKA_CLIENT_SERVICE_URL_DEFAULTZONE=http://admin:$${jhipster.registry.password}@jhipster-registry:8761/eureka
- SPRING_CLOUD_CONFIG_URI=http://admin:$${jhipster.registry.password}@jhipster-registry:8761/config
- SPRING_DATA_MONGODB_URI=mongodb://0.0.0.0:27017
- SPRING_DATA_MONGODB_DATABASE=core
- JHIPSTER_SLEEP=10 # gives time for the JHipster Registry to boot before the application
jhipster-registry:
extends:
file: jhipster-registry.yml
service: jhipster-registry
environment:
- SPRING_CLOUD_CONFIG_SERVER_NATIVE_SEARCH_LOCATIONS=file:./central-config/docker-config/我有个例外:
MongoSocketException: mongodb://0.0.0.0:27017},由{java.net.UnknownHostException: mongodb://0.0.0.0:27017引起
怎么解决这个问题?任何其他的向导都不起作用
发布于 2017-10-30 16:58:34
如果您正在运行Mongo而没有通过对接/对接-组合,它托管在您的本地主机上。
您不能像这样将localhost从主机显示到码头容器(不使用不建议使用的network --host选项)。
我建议您在docker文件中为mongodb创建一个服务,并将其链接到您的主服务。
https://stackoverflow.com/questions/47020421
复制相似问题