运行docker映像时出错
我在执行我创build的图像时遇到了一些问题。 该服务需要连接到mongodb,即使它已经启动,并在localhost:27017上侦听
下面是错误:
INFO 5 --- [localhost:27017] org.mongodb.driver.cluster : Exception in monitor thread while connecting to server localhost:27017 [main] org.mongodb.driver.cluster : No server chosen by WritableServerSelector from cluster description ClusterDescription{type=UNKNOWN, connectionMode=MULTIPLE, all=[ServerDescription{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused (Connection refused)}}]}. Waiting for 30000 ms before timing out
弹簧:
configuration文件:prod,默认
数据:
mongodb: database: robotTxt host: localhost repositories: enabled: true
日志logging:
pattern:file:“%d {yyyy-MM-dd HH:mm:ss} [%thread]%-5level%logger {36} – %msg%n”
控制台:“%d {yyyy-MM-dd HH:mm:ss} – %msg%n”
水平:
ROOT:错误
org.springframework:错误
org.springframework.data:错误
org.mongodb:错误
file:$ {java.io.tmpdir} /application.log