Testing the Service and Client Applications Locally in a Docker Setup

Before you begin
  • Docker must be installed on your machine.
  • Access to a local Consul server.
    Procedure
  1. Run the following command on a Docker terminal to run the service application image:
    docker run -e CONSUL_SERVER_URL=consul-server-url  
    -e DOCKER_LOCAL_HOST_IP=Docker-machine-ip  
    -e DOCKER_LOCAL_HOST_PORT=Docker-machine-port -p 18086:8080 
    -e SERVICE_NAME=BWCE-HELLOWORLD-SERVICE bwce-servicediscovery.service-app
    
  2. Note: DOCKER_LOCAL_HOST_IP: While registering service, the variable value becomes the value for IP address configured with consul service.
    Note: DOCKER_LOCAL_HOST_PORT: While registering service, the variable value becomes the value for PORT configured with consul service.
  3. Run the following command on a Docker terminal to run the service application image:
    docker run -e CONSUL_SERVER_URL=consul-server-url  
    -p 18087:8080 
    -e SERVICE_NAME=BWCE-HELLOWORLD-SERVICE bwce-servicediscovery.client.app
  4. Run the following command to view the logs to make sure that the application has started successfully.
    docker logs <container name>
  5. Check the logs for the service and client applications to make sure they have started successfully.
  6. Get the IP address for the Docker machine.
  7. Access the following URL from a browser:
    http://<docker-machine-ip>:18087
ResultThe following output should be seen in the browser:
Hello from TIBCO"