rancher: Can't bind on 127.0.0.1

Using managed network, trying to create port mapping like 127.0.0.1:24004:24004 opens port on 0.0.0.0

Using host network - port fails to open on both 127.0.0.1 and any other ip.

Use case: I want to create a proxy for logs from docker containers. But because log driver from docker runs on daemon it knows nothing about managed network. I want to create a proxy, running on localhost, that other containers can write to. This proxy will aggregate logs and ship them to other facilities accessible via internal network/internal dns/etc.


Useful Info
Versions Rancher v1.2.2 Cattle: v0.174.13 UI: v1.2.40
Access localauth admin
Orchestration Cattle
Route stack.index

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 4
  • Comments: 18 (2 by maintainers)

Most upvoted comments

@zot24 I found a workaround to that by adding in the edit page of the host the ip: 127.0.0.1. I really don’t know if this is the expected behavior but it works for me now.

selection_002

Any updates guys? Binding on localhost (127.0.0.1) should be a simple feature since 0.0.0.0 is working by default. There are a lot of reasons here (security for example) and maybe the feature can be extended to binding on a specific IP on a host with multiple LANs to cover all of the use cases. Cheers!

So i found a workaround for Rancher 1.6.15 you can expose ports to 127.0.0.1 when you set a specific host under the scheduling tab. So i guess this will be useless for multihost setups.

Tried your compose file on 1.6.13 with a different port because 80 is already bound in my host

image

Unfortunately the result is this:

image

i.e. service cannot be started with these logs

image

Maybe I’m doing something wrong

Any updates on this? Issue seems to be still existing on 1.16.10. We are running a service that needs to proxied on the host but this exposes the service to the internet.

I’m experiencing a similar issue where I got the following configuration (that was working on Rancher 1.2.2)

version: 2
services:
  fluentd:
    image: localhost/fluentd
    env_file: .env
    ports:
      - "127.0.0.1:24224:24224"

But with Rancher Server 1.6.7 I just get the following error

 Upgrading (Failed to allocate instance [container:1i126]: Bad instance [container:1i126] in state [error]: Allocation failed: No healthy hosts meet the resource constraints: [127.0.0.1:24224:24224/tcp portReservation, instanceReservation: 1])
Type: