[zeromq-dev] Connection refused error exclusively in Dockerized app

Kenneth Adam Miller kennethadammiller at gmail.com
Mon Dec 29 17:23:52 CET 2014


On Mon, Dec 29, 2014 at 3:44 AM, Benjamin <benjamin.l.cordes at gmail.com>
wrote:

> Most likely this is an issue with docker. Inside a container processes
> don't know about the outside. You have to specifically mount something
> or use the ports flag [1] or ambassadors [2]. Using inproc between
> host and container will not work. Containers have process isolation.
> Containers map closely to contexts which then use tcp to communicate.
>

There is only communication within processes with inproc; I don't use ipc,
only tcp for cross process/machine communication. No issues with that so
far.

I did try using the ports flag, -P, to see if that would change things in
regards to the bind getting connection refused. I even thought possible it
was my image, so I switched from default ubuntu to phusion/baseimage. Still
busted.


>
> It does make sense combining ZMQ and docker. Unfortunately while
> dotcloud has done work with zeromq [2], [3] the docker semantics are
> based on HTTP/JSON style communication. Depending on what you're
> trying to do, docker might be a lot of overhead.
>

I know that inproc works inside docker, but here you absolutely *must* have
a bind for a inproc before a connect. It works in the host, but it's also
confusing to me.

I think in my message I wrote about a dichotomy in the manual instructions
regarding always do bind before connect yet that you should start all
subscribers first. Subscribers make connect calls... see what I'm saying?
Can anybody elucidate the proper approach?

>
>
> [1] https://docs.docker.com/installation/mac/#container-port-redirection
> [2] https://docs.docker.com/articles/ambassador_pattern_linking/
> [3] https://github.com/dotcloud/zerorpc-python
> [4]
> http://www.infoq.com/presentations/Distributed-Systems-with-ZeroMQ-and-gevent
>
> On Mon, Dec 29, 2014 at 9:25 AM, Pieter Hintjens <ph at imatix.com> wrote:
> > Is this using the same version of ZeroMQ in both cases?
> >
> > On Mon, Dec 29, 2014 at 1:02 AM, Kenneth Adam Miller
> > <kennethadammiller at gmail.com> wrote:
> >> I found out that doing a socket connection on an inproc that hasn't been
> >> bound to yet before is what is causing the error. Strange thing is, in
> >> docker this fails with an exception. On my host, it works fine.
> >>
> >> Does anybody know what the best path forward would be? I basically have
> a
> >> subscriber being launched before the publisher, just as the missed
> message
> >> debugger says I should. Those subscribers make connect calls, but the
> >> publisher makes a bind. Every thing works as required on the host. But
> in
> >> docker, it blows up at the connect line.
> >> What do I do to get it to work?
> >>
> >> On Thu, Dec 25, 2014 at 10:51 AM, Kenneth Adam Miller
> >> <kennethadammiller at gmail.com> wrote:
> >>>
> >>> I have a dockerized ZMQ instance where I am trying to develop an app. I
> >>> have duplicate source both inside the docker instance and at the host
> level.
> >>> I can compile both inside and out with duplicate compiler output and
> both
> >>> compile.
> >>>
> >>> The problem is, there has to be some difference between the docker
> ubuntu
> >>> instance and the host, because when I run the docker ubuntu instance,
> I get
> >>> an error at runtime with my unit tests:
> >>>
> >>> terminate called after throwing an instance of 'zmq::error_t'
> >>>   what():  Connection refused
> >>>
> >>> But the unit tests run to completion on the host.
> >>> I've debugged it, and put print statements, and I know for certain that
> >>> the docker instance is failing at a socket connect call.
> >>>
> >>> sock = new zmq::socket_t(ctxt, ZMQ_SUB);
> >>>
> >>> sock->connect("inproc://something");  //<-- FAILS HERE!
> >>>
> >>> Currently I have some confusion as to why it works this way in the
> host,
> >>> because I have a subscriber connecting to an inproc instance that
> doesn't
> >>> have anything bound at yet, but the missing message problem solver in
> the
> >>> ZMQ guide says start subscribers first and then the publisher. In any
> case,
> >>> it works very well on the host.
> >>>
> >>> Can anybody tell me how to debug a connection refused error?
> >>
> >>
> >>
> >> _______________________________________________
> >> zeromq-dev mailing list
> >> zeromq-dev at lists.zeromq.org
> >> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> >>
> > _______________________________________________
> > zeromq-dev mailing list
> > zeromq-dev at lists.zeromq.org
> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20141229/dfb696e6/attachment.htm>


More information about the zeromq-dev mailing list