[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Gear link from container localhost to host localhost address



On 30 June 2014 17:29, Clayton Coleman <ccoleman redhat com> wrote:
<snip>
>> Jun 30 16:35:54 localhost.localdomain gear[10239]: Using 10.0.2.15/24
>> for 127.0.0.1
>
> This means we correctly translated localhost to 10.0.2.15 for the mapping

Oh! I I'd hadn't read the output thoroughly. It's forwarding the
traffic to the non-loopback IP on the host; not 127.0.0.1

And my receiving test socket was listening explicitly on 127.0.0.1.

So I just need to change that to listen on all interfaces and my test
now passes.

Would it be possible to route the connection to the host's loopback
address? I guess it would involve tunnels or something.

Anyway, thanks.

-RichardW.


PS here's an example showing how to setup a unit with links using the
REST API and curl. I should probably submit a pull request for this to
be included in the documentation or README.

$ curl -v -X PUT "http://127.0.0.1:43273/container/my-sample-service";
-H "Content-Type: application/json" -d '{"Started": true,
"NetworkLinks": [{"ToPort": 44831, "FromPort": 31337, "FromHost":
"127.0.0.1", "ToHost": "127.0.0.1"}], "Image":
"openshift/busybox-http-app", "Ports": []}'

* upload completely sent off: 173 out of 173 bytes
< HTTP/1.1 204 No Content

$ sudo gear list-units
ID                SERVER  ACTIVE  SUB     LOAD    TYPE
my-sample-service         active  running loaded

]$ sudo gear status my-sample-service
ctr-my-sample-service.service - Container my-sample-service
   Loaded: loaded
(/var/lib/containers/units/my/ctr-my-sample-service.service; enabled)
   Active: active (running) since Mon 2014-06-30 18:04:14 BST; 2min 13s ago
 Main PID: 13337 (docker)
   CGroup: /container.slice/container-small.slice/ctr-my-sample-service.service
           └─13337 /usr/bin/docker run --rm --name my-sample-service
--volumes-from my-sample-service-data -a stdout -a stderr
openshift/busybox-http-app

Jun 30 18:04:13 localhost.localdomain sh[13320]: Reusing <no value>
Jun 30 18:04:13 localhost.localdomain docker[13330]: Error: No such
container: my-sample-service
Jun 30 18:04:13 localhost.localdomain docker[13330]: 2014/06/30
18:04:13 Error: failed to remove one or more containers
Jun 30 18:04:13 localhost.localdomain gear[13338]: user: unknown user
ctr-my-sample-service
Jun 30 18:04:14 localhost.localdomain docker[13337]: Serving
/usr/mock/source/ on port 8080...
Jun 30 18:04:14 localhost.localdomain gear[13338]: Updating network
namespaces for 13385
Jun 30 18:04:14 localhost.localdomain gear[13338]: Using 10.0.2.15/24
for 127.0.0.1
Jun 30 18:04:14 localhost.localdomain gear[13338]: Mapping
172.17.0.87(127.0.0.1):31337 -> 10.0.2.15:44831
Jun 30 18:04:14 localhost.localdomain systemd[1]: Started Container
my-sample-service.
Jun 30 18:04:34 localhost.localdomain systemd[1]: Started Container
my-sample-service.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]