a-bali/janitor

docker container with ports?

somedevreally opened this issue · 4 comments

Hello,
i have docker containers with different ports with same IP how do i add them?, is this kind of setup is
supported? i tried adding

 http:
  - name: container_name
    address: http://x.x.x.x:port
  - name: container_name2
    address: http://x.x.x.x:port2

error:net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

Works for me (see below), are you using IP addresses that are accessible from Janitor's container? If yes, try increasing the timeout.

Sample config:

http:
  - name: "this works"
    address: http://google.com:80
  - name: "this does not work"
    address: http://google.com:81

Output:

screenshot

i tried

and the Janitor container has access to another container (both are on same docker network)

if i increase the timeout i get this error
Get http://x.x.x.x:port: dial tcp x.x.x.x:port: i/o timeout

Also does Janitor container needs to have access to other container internally ip? 172.x.x.x
as it checks the access through http so it should be able to access other container by its lan ip isn't it? http://192.x.x.x

The error messages simply show that Janitor is not able to connect to the given address. I suspect your issue is more related to Docker networking and not to Janitor itself.

If you could first try running Janitor without Docker (it is a single binary only), specifying the external address you use to access the web services of your containers (including the port), that could confirm it.

If you run Janitor within Docker, I believe you should either:

  1. Use the external addresses that you use to access the web services (most probably this is 192.168.x.y), including the port number that you use for access from outside Docker

or

  1. Use the docker container name only if you are running on the same Docker network (you specified this explicitly to Docker), you also specified the container name and you use the internal port number of the service within the container (not the external one).

If you could share more of your Docker configuration, I could probably help with that.

yes the janitor is fine, its the docker network issue, thanks