0
votes

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?

1

1 Answers

1
votes

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:

  1. Your container is not responding or
  2. 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.

Steps:

  1. Install cf and the cf ic plugin if needed.
  2. cf login
  3. cf ic login
  4. 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

  5. cf ic ip request

    --- this will give you an IP address

  6. 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.