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/06/28 20:23:30 UTC

docker containers connection

Hello Timothy,

We have one issue regarding connecting docker containers. We have one
docker container which contains apache airavata API server which runs on
8930 port inside the container. During container image building we have
exposed port 8930 . After linking that container to another we can see the
exposed port in the second containers environment variables. But when ever
trying to access that port we are getting connection refuse error.

here are  the commands:

*docker run --name cont1 -i -d  -t psaha4/airavata_all /bin/bash*
*docker run --name cont2 -i -d  -t psaha4/airavata_pga /bin/bash*
*docker attach cont2*
*env*
here we can see *CONT1_PORT= tcp://172.17.0.44:8930
<http://172.17.0.44:8930>*
but when try to execute
*nc -zv 172.17.0.44 8930* , its saying connection refused.

It will be really a great help if you can show us some path to achieve the
container inter connection.

Thanks
Pankaj

Re: docker containers connection

Posted by Timothy Chen <tn...@gmail.com>.
Hi Pankaj,

Seems like this is not Mesos related but Docker specific, in general I
can answer more Mesos or Mesos/Docker integration questions.

I think what happens in your case is that you're exposing the port in
the container network namespace, but since the container was setup
with default bridge network (--net=bridge is the default), the port
that is mapped on the host is going to be a ephmeral port.

Instead of trying to expose ports this way, another way is to
basically link them directly with --link. Otherwise you can also use
host network, or if you still want to use bridge network try to map
the host and container port to be the same (-p 8930:8930).

Tim

On Sun, Jun 28, 2015 at 11:23 AM, Pankaj Saha <ps...@binghamton.edu> wrote:
> Hello Timothy,
>
> We have one issue regarding connecting docker containers. We have one docker
> container which contains apache airavata API server which runs on 8930 port
> inside the container. During container image building we have exposed port
> 8930 . After linking that container to another we can see the exposed port
> in the second containers environment variables. But when ever trying to
> access that port we are getting connection refuse error.
>
> here are  the commands:
>
> docker run --name cont1 -i -d  -t psaha4/airavata_all /bin/bash
> docker run --name cont2 -i -d  -t psaha4/airavata_pga /bin/bash
> docker attach cont2
> env
> here we can see CONT1_PORT= tcp://172.17.0.44:8930
> but when try to execute
> nc -zv 172.17.0.44 8930 , its saying connection refused.
>
> It will be really a great help if you can show us some path to achieve the
> container inter connection.
>
> Thanks
> Pankaj
>
>