无法连接到我的Bluemix容器(连接:关闭)

时间:2017-01-12 12:57:54

标签: docker containers command-line-interface ibm-cloud

大家好,新年快乐,

我在连接到我的bluemix容器时遇到了一些问题, 我跟着这个IBM's Bluemix guide 学习如何将docker镜像拉到bluemix图像库,它可以工作。

然后我执行命令打开端口9080服务器端(根据我的Dockerfile,vm为5000)

PS :((我尝试使用-P而不是-p 9080或-p 9080:5000,但没有解决此问题))

cf ic -v run -d -p 9080 --name testdebug registry.ng.bluemix.net/datainjector/esolom python testGUI.py

在“cf ic ps”之后,我获得了:

CONTAINER ID      IMAGE       
8457d4bb-247      registry.ng.bluemix.net/datainjector/esolom:latest 

COMMAND                 PORTS          NAMES  
"python testGUI.py "    9080/tcp      testdebug

debug命令(在运行图像时执行)报告给我:

DEMANDE : [2017-01-12T11:57:42+01:00]
POST /UAALoginServerWAR/oauth/token HTTP/1.1
Host: login.ng.bluemix.net
Accept: application/json
Authorization: [DONNEES PRIVEES MASQUEES]
Connection: close
Content-Type: application/x-www-form-urlencoded
User-Agent: go-cli 6.22.2+a95e24c / darwin

grant_type=refresh_token&refresh_token=eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJmMTE5ZTI2MC0zZGE4LTQ5NzctOTI4OS05YjY1ZDcwMmM2OWQtciIsInN1YiI6ImZkMWVmM2Q3LTI2OTQtNDQ4Ni1iNjY2LWRmNTVjY2M4MzVmOCIsInNjb3BlIjpbIm9wZW5pZCIsInVhYS51c2VyIiwiY2xvdWRfY29udHJvbGxlci5yZWFkIiwicGFzc3dvcmQud3JpdGUiLCJjbG91ZF9jb250cm9sbGVyLndyaXRlIl0sImlhdCI6MTQ4NDIxMTE1NSwiZXhwIjoxNDg2ODAzMTU1LCJjaWQiOiJjZiIsImNsaWVudF9pZCI6ImNmIiwiaXNzIjoiaHR0cHM6Ly91YWEubmcuYmx1ZW1peC5uZXQvb2F1dGgvdG9rZW4iLCJ6aWQiOiJ1YWEiLCJncmFudF90eXBlIjoicGFzc3dvcmQiLCJ1c2VyX25hbWUiOiJlbW1hbnVlbC5zb2xvbUBmci5pYm0uY29tIiwib3JpZ2luIjoidWFhIiwidXNlcl9pZCI6ImZkMWVmM2Q3LTI2OTQtNDQ4Ni1iNjY2LWRmNTVjY2M4MzVmOCIsInJldl9zaWciOiI2MWNkZjM4MiIsImF1ZCI6WyJjZiIsIm9wZW5pZCIsInVhYSIsImNsb3VkX2NvbnRyb2xsZXIiLCJwYXNzd29yZCJdfQ.PIQlkKPDwxfa0c6951pO52qcAzggfPGrsCMuFl4V-eY&scope=

REPONSE : [2017-01-12T11:57:42+01:00]
HTTP/1.1 200 OK
Connection: close
Transfer-Encoding: chunked
Cache-Control: no-cache, no-store, max-age=0, must-revalidate,no-store
Content-Security-Policy: default-src 'self' www.ibm.com 'unsafe-inline';
Content-Type: application/json;charset=UTF-8
Date: Thu, 12 Jan 2017 10:57:42 GMT
Expires: 0
Pragma: no-cache,no-cache
Server: Apache-Coyote/1.1
Strict-Transport-Security: max-age=2592000 ; includeSubDomains
X-Archived-Client-Ip: 169.54.180.83
X-Backside-Transport: OK OK,OK OK
X-Client-Ip: 169.54.180.83,91.151.65.169
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-Global-Transaction-Id: 3429006079
X-Powered-By: Servlet/3.1
X-Vcap-Request-Id: 8990fd56-827c-4956-696d-497922464ac0,04094b44-0ace-    4891-6ec0-c4855fd481f7
X-Xss-Protection: 1; mode=block

6f6
{"access_token":"[DONNEES PRIVEES MASQUEES]","token_type":"[DONNEES PRIVEES MASQUEES]","refresh_token":"[DONNEES PRIVEES MASQUEES]","expires_in":1209599,"scope":"cloud_controller.read password.write cloud_controller.write openid uaa.user","jti":"9619d1dd-995f-41b4-8a8a-825af8397ccb"}
0


ae4b3e08-4ba6-47d9-bf1f-30654af7fcfc

接下来,我将请求的IP绑定到:

cf ic ip request // 169.46.18.243 was given
cf ic ip bind 169.46.18.243 testdebug
OK
The IP address was bound successfully.

“cf ic ps”命令给了我这个:

CONTAINER ID        IMAGE                                                 
1afd6916-718        registry.ng.bluemix.net/datainjector/esolom:latest

COMMAND                CREATED             STATUS                  
 "python testGUI.py "   5 minutes ago       Running 5 minutes ago

PORTS                          NAMES
169.46.18.243:9080->9080/tcp   testdebug

相关日志:

 cf ic logs -ft testdebug
 2017-01-12T12:45:54.531512850Z /usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:334: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
 32017-01-12T12:45:54.531555759Z   SNIMissingWarning
 �2017-01-12T12:45:54.531568916Z /usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:132: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
 92017-01-12T12:45:54.531576871Z   InsecurePlatformWarning
 �2017-01-12T12:45:54.836875400Z /usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:132: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
 92017-01-12T12:45:54.836895214Z   InsecurePlatformWarning
 �2017-01-12T12:45:54.884966459Z WebSocket transport not available. Install eventlet or gevent and gevent-websocket for improved performance.
 Y2017-01-12T12:45:54.889150620Z  * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)

那么,是否将相同的端口归因于主机和VM负责调试日志中的“connection:close”?或者是那两个不同的问题?

“connection:close”是否说明我无法连接到网络应用程序?

你知道如何解决这个问题吗? (要在图像中修复某些内容?还是在CLI中添加其他选项?)

感谢您的阅读,您的承诺以及您的答案!

PS: 线索:我正在寻找修改Dockerfile,我读到我必须有2条指令才能将我的docker镜像集成到Bluemix,这是一个睡眠命令,所以我确定容器在调用之前已经启动了,显然是“ENV PORT 3000”指令,这里是我的Dockerfile,不要犹豫复习它,容易发生简单的错误。

FROM ubuntu:14.04
RUN apt-get update && apt-get -y install python2.7
RUN apt-get -y install python-pip
RUN pip install Flask
RUN pip install ibmiotf
RUN pip install requests
RUN pip install flask-socketio
RUN pip install cloudant
ENV PORT=3000
EXPOSE 3000
ADD ./SIARA /opt/SIARA/
WORKDIR /opt/SIARA/
CMD (sleep 60)
CMD ["python", "testGUI.py"]

1 个答案:

答案 0 :(得分:0)

将Dockerfile更改为:

CMD sleep 60 && python testGUI.py 

看到@gile评论后。

即使它没有立即起作用,但在3小时后效果出奇的好!

编辑:似乎这只是一个幸运的镜头,我无法再次访问容器,我的想法是它工作,因为我的dockerHub在提交Dockerfile上的更改后重建了图像因为它在我之后工作将图像从dockerhub repo复制到bluemix private repo。

是否突出了问题?因为我不明白为什么它再也没有起作用......