Issues using Ruby to get stdout of container running in swarm

I don’t know if this is an issue with Ruby or Docker, but I’m asking here in the hope that it will help me figure out what is going on.

I have a docker swarm instance which I can use like a normal docker instance and run containers like so (the instance running on port 1234 is the swarm instance):

$ docker -H tcp://x.x.x.x:2375 run --rm ruby:2.2.1 echo hi
$ docker -H tcp://x.x.x.x:1234 run --rm ruby:2.2.1 echo hi

However if I use the Open3 ruby module to execute those same commands, the swarm instance causes an issue where stdout is completely empty, whereas the container running directly on the docker host does not have any problems:

irb(main):001:0* output,process = Open3.capture2e('docker -H tcp://x.x.x.x:2375 run --rm ruby:2.2.1 echo hi')
=> ["hi\n", #<Process::Status: pid 754 exit 0>]
irb(main):002:0> output,process = Open3.capture2e('docker -H tcp://x.x.x.x:1234 run --rm ruby:2.2.1 echo hi')
=> ["", #<Process::Status: pid 768 exit 0>]

I’m completely baffled by this and have reached the limits of my understanding regarding how unix pipes work with ruby. Any assistance would be greatly appreciated :slight_smile: