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

  • Strange Docker + Celery Bug
  • How to build docker image frome .drone.yml?
  • CircleCI - Git could not resolve host when cloning repository
  • Installing Docker with script on Windows
  • docker-compose up leads to “client and server don't have same version (client : 1.14, server: 1.12)” error but client and server have the same version
  • Unable to connect to SQL Server Express container on host VM
  • 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?

  • Creating an Azure Container Service with default settings fails to deploy
  • Moving docker-compose containersets around between hosts
  • Access host database from a docker container
  • Can't reach ActiveMQ from inside Docker container
  • Jenkins on GCE not building
  • How to create Docker-image from my app? It's node.js application that use MongoDB
  • 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:

    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.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.