How to point load balancer at docker created container (that isn't a service)?


Apologies if this has been already asked and answered but I’m having a little bit of trouble figuring out how to make a load balancer point at one of my “normal” containers. I.E. a container I’ve created through the docker cli on the host.

The reason for this currently is that we’re building this docker image interally and having it update via a CI system. I can’t currently make it a service at the moment (although this may be on the cards in the future).

From what I can tell I can only point the load balancer at Services? Is there any way to point it at a container directly or just point it at a specific port on the host?

Many Thanks,

Okay, this is how I would do it.

  1. You’ll need to make sure that your standalone container created has 2 labels on it.

Label 1: io.rancher.container.dns: true
Label 2: Something that a selector link can pick up

  1. Create a service with a label for a selector link where you can add this label io.rancher.service.selector.container so that the service will pick up the container as part of it’s DNS.

  2. Then you can point your LB to the service which should route to the standalone container.

Note: I haven’t tried this out myself, but I believe this should work. :slight_smile: