Docker container can't leverage external Cloud

2019-06-26 09:23发布

I've built a Container that leverages a CF app that's bound to a service, Cloudant to be specific.

When I run the container locally I can connect to my Cloudant service.

When I build and run my image in the Bluemix container service I can no longer connect to my Cloudant service. I did use --bind to bind my app to the container. I have verified that the VCAP_Services info is propagating to my container successfully.

To narrow the problem down further, I tried just doing an

ice -run --name NAME IMAGE_NAME ping CLOUDANT_HOST

and I found I was getting an unknown host.

So I then tried to just ping the IP, and got Network is unreachable.

If we can not resolve bluemix services over the network, how can we leverage them? Is there just a temporary problem, or perhaps I'm missing something?

Again, runs fine locally but fails when hosted in the container service.

标签: ibm-cloud
2条回答
We Are One
2楼-- · 2019-06-26 10:03

looking at your problem it could be related to a network error on container when on Bluemix. Try to access your container through shell when on Bluemix (using cf ic console or docker one) and check if the network has been rised correctly and then if its network interface(s) has an IP to use.

查看更多
叛逆
3楼-- · 2019-06-26 10:21

It has been my experience that networking is not reliable in IBM Containers for about 5 seconds at startup. Try adding a "sleep 10" to your CMD or ENTRYPOINT. Or set it up to retry for X seconds before giving up.

Once the networking comes up it has been reliable for me. But the first few seconds of a containers life have had troubles with DNS, binding, and outgoing traffic.

查看更多
登录 后发表回答