can someone think of a reason why a jar running on...
# server
f
can someone think of a reason why a jar running on a docker image running in ecs would respond fine when curled
Copy code
curl --request GET \
    --location '<https://my.service.elb/actuator/prometheus>' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Basic BLABLA' \
    --header 'Host: <http://ws-preprod-api.eng.mycompany.com|ws-preprod-api.eng.mycompany.com>' \
    --insecure
Copy code
# HELP CalculateTaxEndpoint_invoke90_count_total
# TYPE CalculateTaxEndpoint_invoke90_count_total counter
CalculateTaxEndpoint_invoke90_count_total{calc="invoke90",} 0.0
but when a sidecar running alongside it in ecs makes requests to it it doesn't work
Copy code
<http://127.0.1:9001/actuator/prometheus>
Copy code
Failed to establish a new connection: Connection refused
we're pretty sure the port and protocol are correct, because when i run the target docker image locally likewise I can
Copy code
curl <http://127.0.0.1:9001/actuator/prometheus> //works fine
e
It might not be using
127.0.0.1
as loopback. Try 0.0.0.0
1
m
also,
127.0.1
is not a valid ip,
127.0.0.1
is however
f
@Emil Kantis woot! will do @Miroljub Enjaković [EpicGuy4000] great spot, thanks! I've confirmed however that was just a typo when I wrote the message 🙃 and we were always dealing with 127.0.0.1 in the code and configs
e
Try
localhost
also 🙂
f
yeah good call localhost we started with and it likewise didn't work 😕 fingers crossed for 0.0.0.0, if it works I'll be both surprised (never seen that before!) and extremely grateful!!
e
Does ECS run sidecars in bridged network mode? Otherwise you might need to refer to your main container by name? 🤔
m
A note from the docker documentation: https://docs.docker.com/desktop/networking/#i-want-to-connect-from-a-container-to-a-service-on-the-host If accessing host from within container, use
host.docker.internal
as DNS name
But for ECS it might be different, if you find it is can you please share? 🙂