You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@airavata.apache.org by Pankaj Saha <ps...@binghamton.edu> on 2015/07/01 00:30:04 UTC
Docker communication across containers
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
Re: Docker communication across containers
Posted by Pankaj Saha <ps...@binghamton.edu>.
Hi Shameera,
Yes your suggested changes are working and I am able to run all three
docker containers.
regarding the containers ip, we will pass them as environment variable
during docker container creation instead of linking them. Properties files
values will be replaced with the env variables in the startup.
Thanks again for finding the solution.
I will prepare a Dockerfile and a docker image for this.
Thanks
Pankaj
On Wed, Jul 1, 2015 at 4:38 PM, Shameera Rathnayaka <sh...@gmail.com>
wrote:
> Hi Pankaj,
>
> I could able to reproduce this with my docker images and finally fix it :)
> . Here are the steps i followed in order to fix this. all you need to
> change is few properties in airavata-server.properties.
>
>
> - changed apiserver.server.host=localhost
> to apiserver.server.host=<docker container Ip> // in my case it
> is apiserver.server.host=172.17.0.96
>
> This will solve connection issue you are facing. Thrift uses these host
> configuration to bind it ports, if you configure to use localhost then is
> not accessible to different docker container as they are logically two
> separate machines.
>
> Then you will get few error pages for browse functions.
>
> - changed default.registry.gateway=php_reference_gateway
> to default.registry.gateway=default
>
> This will solve that browse functions errors.
>
>
> You don't need to link any container when you do "docker run". eg: don't
> need to link rabbitmq container with airavataServer container or
> airavataServer container with PGA container.
>
> I did port forwarding between my boot2docker(This is how docker works in
> OS X) VM and My machine, which i don't think you need to do because, linux
> dockers runs on the same host linux environment instead of separate vm.
>
>
> Thanks,
> Shameera.
>
>
> On Tue, Jun 30, 2015 at 6:30 PM, Pankaj Saha <ps...@binghamton.edu>
> wrote:
>
>> 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
>>
>>
>>
>>
>>
>
>
> --
> Best Regards,
> Shameera Rathnayaka.
>
> email: shameera AT apache.org , shameerainfo AT gmail.com
> Blog : http://shameerarathnayaka.blogspot.com/
>
Re: Docker communication across containers
Posted by Shameera Rathnayaka <sh...@gmail.com>.
Hi Pankaj,
I could able to reproduce this with my docker images and finally fix it :)
. Here are the steps i followed in order to fix this. all you need to
change is few properties in airavata-server.properties.
- changed apiserver.server.host=localhost
to apiserver.server.host=<docker container Ip> // in my case it
is apiserver.server.host=172.17.0.96
This will solve connection issue you are facing. Thrift uses these host
configuration to bind it ports, if you configure to use localhost then is
not accessible to different docker container as they are logically two
separate machines.
Then you will get few error pages for browse functions.
- changed default.registry.gateway=php_reference_gateway
to default.registry.gateway=default
This will solve that browse functions errors.
You don't need to link any container when you do "docker run". eg: don't
need to link rabbitmq container with airavataServer container or
airavataServer container with PGA container.
I did port forwarding between my boot2docker(This is how docker works in OS
X) VM and My machine, which i don't think you need to do because, linux
dockers runs on the same host linux environment instead of separate vm.
Thanks,
Shameera.
On Tue, Jun 30, 2015 at 6:30 PM, Pankaj Saha <ps...@binghamton.edu> wrote:
> 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
>
>
>
>
>
--
Best Regards,
Shameera Rathnayaka.
email: shameera AT apache.org , shameerainfo AT gmail.com
Blog : http://shameerarathnayaka.blogspot.com/