502 error when viewing Java liberty Bluemix application using Docker container
I created a Java Liberty application on Bluemix and cloned the sample code from the JazzHub Git repository linked to the application.
I then copied the JavaHelloWorldApp.war file to the base directory of the sample code and created a Dockerfile with the following text:
FROM registry.ng.bluemix.net/ibmliberty:javaee7 ADD JavaHelloWorldApp.war /opt/ibm/wlp/usr/servers/defaultServer/dropins/
I set up the DevOps pipeline to build an image and then create a container following this example Node.js application: https://hub.jazz.net/deploy/index.html?repository=https://github.com/Puquios/hello-containers
The application successfully builds and deploys, however I receive the following error when I go to view the url for the new container application:
502 Bad Gateway: Registered endpoint failed to handle the request.
How do I fix this?
One Solution collect form web for “502 error when viewing Java liberty Bluemix application using Docker container”
A 502 error means that the router can not get a response from the container in your group. There are two possible causes for this:
- Your container is not responding or
- There is a routing error and your container is running fine.
To test #1, you will need to use cf ic to bind an IP address to the running container and then curl against that IP address:port to see if the container is responding.
- Install cf and the cf ic plugin if needed.
- cf login
- cf ic login
cf ic ps
— this will give you the container ID. If you have multiple running containers you can do a cf ic inspect [container-ID] to see which one is in your group. It will also display the port
cf ic ip request
— this will give you an IP address
cf ic ip bind [IP address] [container-ID]
Now go to the [IP address]:[port] and see if you can access your application.
If you can access your application via IP address let me know and I can follow-up with the router problem.