0
我有兩個容器,一個使用AuthServer,另一個使用api rest/Resource服務器。Docker錯誤解決主機和POST請求上的I/O錯誤http://es.example/oauth/check_token連接被拒絕
流程的工作原理與AuthServer容器上和ResourceServer地方,但是當我部署資源服務器進入容器顯示:
"error": "Internal Server Error",
"exception": "org.springframework.web.client.ResourceAccessException",
"message": "I/O error on POST request for \"http://es.example/oauth/check_token\": Connection refused; nested exception is java.net.ConnectException: Connection refused",
我究竟做錯了什麼?
注意:如果我留入容器ping成功:S
泊塢文件是相同的:
FROM xxx.xxx.xxx.xxx:5000/services-base:1.0
EXPOSE 8080
# Services
ADD build/libs/service-authServer.jar /opt/app.jar
WORKDIR /opt
RUN sh -c 'touch app.jar'
ENTRYPOINT ["java","-Dlogging.config=config/logback.xml","-jar","app.jar"]
圖像的基礎是高山的Linux與Java 8
我們部署ansible有:
- name: Container is running
docker:
image: "{{ registry_url }}/{{ services_oauth2_container }}"
name: "{{ services_oauth2_name }}"
ports: "{{ services_oauth2_ports }}"
hostname: "{{ hostname }}"
env:
TZ: "{{ timezone_value }}"
SERVICE_NAME: "{{ services_oauth2_name }}"
volumes: "{{ volumes }}"
tags: [service]
迪登特魯德爾contenedor
[[email protected]~]# docker exec -it service-rest sh
/opt # curl -X GET 'http://es.example:2474/api/v1/rest/ping'
curl: (7) Failed to connect to es.example port 2474: Connection refused
/opt # curl -X GET 'http://es.example/api/v1/rest/ping'
curl: (7) Failed to connect to es.example port 80: Connection refused
/opt # curl -X GET 'http://localhost:8080/api/v1/rest/ping'
{"timestamp":1467184337030,"status":500,"error":"Internal Server Error","exception":"org.hibernate.exception.GenericJDBCException","message":"could not inspect JDBC autocommit mode","path":"/api/v1/rest"
/opt # curl -X GET 'http://localhost:8080/me'
/opt # curl -H 'Authorization: Bearer 76cac1c1-c2e6-4a16-a64c-f347d9e38793' -X GET 'http://localhost:8080/me'
{"timestamp":1467184455211,"status":500,"error":"Internal Server Error","exception":"org.springframework.web.client.ResourceAccessException","message":"I/O error on POST request for \"http://es.example:2490/oauth/check_token\": Connection refused; nested exception is java.net.ConnectException: Connection refused","path":"/me"}/opt #
/opt #
/opt # curl -X GET 'http://es.example:2490/oauth/check_token?token=76cac1c1-c2e6-4a16-a64c-f347d9e38793'
curl: (6) Couldn't resolve host 'es.example'
/opt # curl -X GET 'http://es.example:2490/oauth/check_token?token=76cac1c1-c2e6-4a16-a64c-f347d9e38793'
curl: (7) Failed to connect to es.example port 2490: Connection refused
/opt # curl -X GET 'http://xxx.xxx.xxx.xxx:2490/oauth/check_token?token=76cac1c1-c2e6-4a16-a64c-f347d9e38793'
{"error":"invalid_token","error_description":"Token has expired"}/opt # ping es.example
PING es.example (xxx.xxx.xxx.xxx): 56 data bytes
64 bytes from xxx.xxx.xxx.xxx: seq=0 ttl=64 time=0.085 ms
64 bytes from xxx.xxx.xxx.xxx: seq=1 ttl=64 time=0.066 ms
64 bytes from xxx.xxx.xxx.xxx: seq=2 ttl=64 time=0.069 ms
64 bytes from xxx.xxx.xxx-xxx: seq=3 ttl=64 time=0.060 ms
^C
--- es.example ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 0.060/0.070/0.085 ms
/opt # curl -X GET 'http://xxx.xxx.xxx.xxx:2490/oauth/check_token?token=76cac1c1-c2e6-4a16-a64c-f347d9e38793'
/opt # curl -X GET 'http://xxx.xxx.xxx.xxx:2490/oauth/check_token?token=789cb37b-53b4-4f49-9ae7-c4a7f93c7df5'
{"exp":1467185199,"user_name":"admin","authorities":["USER","client_id":"clientID","scope":["read","write"]}
請發佈您的Dockerfiles /撰寫文件/如何運行這些容器? – johnharris85
我已經實現了這個帖子 –