connect: connection refused when running in a docker container

313 views
Skip to first unread message

dbeaugrand

unread,
Jul 15, 2022, 1:58:28 PM7/15/22
to KrakenD Community
I'm new to krakend and working on putting together a proof of concept example. I have created a simple GET call to a Nodered (NodeJS) service that returns a simple "hello world". When I call GET url from postman directly to the service it responds properly. When I try and call this as an endpoint via Krakend I get a connection refused error in the console out.

Here ismy krakend.json:
{
"version": 3,
"timeout": "3000ms",
"cache_ttl": "300s",
"name": "CHPIDA-CORE-API",
"port": 8080,
"host": ["http://127.0.0.1:8080"],
"disable_rest": true,
"extra_config": {
"telemetry/logging": {
"level": "DEBUG",
"prefix": "[KRAKEND]",
"syslog": false,
"stdout": true
},
"telemetry/metrics": {
"collection_time": "60s",
"proxy_disabled": false,
"router_disabled": false,
"backend_disabled": false,
"endpoint_disabled": false,
"listen_address": ":8090"
},
"security/cors": {
"allow_origins": [
"*"
],
"allow_methods": [
"GET",
"HEAD",
"POST",
"OPTIONS"
],
"expose_headers": [
"Content-Length",
"Content-Type"
],
"allow_headers": [
"Accept-Language"
],
"max_age": "12h",
"allow_credentials": false,
"debug": false
}
},
"endpoints": [
{
"endpoint": "/default-behavior",
"backend": [
{
"url_pattern": "/__debug/default"
}
]
},
{
"endpoint": "/v1/api/hello",
"method": "GET",
"output_encoding": "json",
"backend": [
{
"url_pattern": "/api/hello",
"encoding": "json",
"method": "GET",
}
],
"extra_config": {

}
}
]
}

as you can see I have changed the endpoint host to match what is in my docker compose file for the service endpoint. As a note: I have consoled into the docker services and pinged the service names to ensure that the services can see each other from the "bridge" configuration of my docker containers. I'm currently running the "latest" label on the docker image. Here is the docker compose snippet:

# #######################################
# Krakend (CHPIDA Core) API Gateway Service
# #######################################
chpida-krakend-core-api-gateway:
image: devopsfaith/krakend:latest
container_name: chpida-krakend-core-api-gateway
env_file: .env
ports:
- 8080:8080
- 8090:8090
depends_on:
- chpida-nodered-core
volumes:
- ./storage/krakend:/etc/krakend
command: "run -dc krakend_core_api.json"
networks:
- app-tier
# #######################################

Any help you could provide would be appreciated.

Daniel Lopez

unread,
Aug 18, 2022, 12:56:11 PM8/18/22
to KrakenD Community, dsbea...@gmail.com
Hi,

could you paste the error you are getting from krakend?

Kind regards
Reply all
Reply to author
Forward
0 new messages