airavata-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pankaj Saha <psa...@binghamton.edu>
Subject Docker communication across containers
Date Tue, 30 Jun 2015 22:30:04 GMT
Hi Suresh/Shameera/Chathuri

Here is a new update regarding the inter container communication. I believe
its not a problem with docker or its ip tables.I feel its about how
airavata exposes the API server port.

During last semester Prof. Madhu has asked us to do an assignment for a
server client interaction application in java socket. I took that
application and created containers for server and client both and they are
interacting without any issue(I can see server messages coming back).
Interesting fact is even though they are working still I can see connection
refuse from the server port. So connection refuse is not the only symptom
to say that containers are not connected.

Now I have added the same server code inside the airavata server container.
And I am able to get service from a different container. Which clearly
indicates that its not an issue with docker port forwarding.

*In case you want to try:*

download the email attachment project (jdk8 and ANT)

docker pull ubuntu
docker run -i -d -t --name prime ubuntu /bin/bash

see how to copy file from local host to docker container is here
> <http://stackoverflow.com/questions/22907231/copying-files-from-host-to-docker-container>


docker attach prime
tar -zxvf saha_pankaj_assign2.tar.gz

install jdk8 and ant inside the container

exit
docker commit prime prime
docker run -i -d --name primeServer --expose 9999 -t prime /bin/bash
docker attach primeServer

cd primeService/src/
pico build.xml

change the XML values as below

> <java jar="${BUILD}/jar/primeService.jar"  fork="true">

                <arg value="*s*"/>
>                 <arg value="9999"/>
>                 <arg value="4"/>
>                 <arg value="

                <arg value="9999"/>

                <arg value="4"/>

                <arg value="*localhost*"/>
>  </java>


ant
ant run

> This should open a server menu prompt

keep this terminal alive

open another terminal


docker run -i -d --name primeClient --link primeServer:primeServer -t prime
/bin/bash
docker attach primeClient

cd primeService/src/
pico build.xml

change the XML values as below

> <java jar="${BUILD}/jar/primeService.jar"  fork="true">

                <arg value="*c*"/>

                <arg value="9999"/>

                <arg value="4"/>

                <arg value="*172.17.0.78*"/>   --note: this shld be ip of
> primeServer container

 </java>


ant
ant run

This should open a client prompt menu. It server is not running client will
> exit with connection error.



Thanks
Pankaj

Mime
View raw message