Can't test api using docker quickstart

I followed docker instructions and in docker-composer yml files I set gateway to port 81:80 and 8081:8080 because original ports are already taken. I am able to create users and APIs through dashboard but when I try to curl newly created test API as in instructions I receive the following error: curl: (56) Recv failure: Connection reset by peer.

There are no relevant errors in gateway and dashboard.

I don’t think you are even hitting the container otherwise the gateway would log something. The gateway port should be open though otherwise you could not hook the gateway up to redis.

Are your logs normal before trying this? If you restart the gateway do you see the API you created listed as a listen path?

Hi Josh, thanks for quick reply.

Yes the gateway lists the api as registered even without restart:

time="Dec 6 14:43:27" level=info msg="Processed and listening on: /test-api/{rest:.*}"

Here are the parameters which I changed for tyk_quckstart. Note that firewall is not active.

tyk.conf

{
"listen_port": 8081,
....
}

docker-compose.yml

{
...
tyk_gateway:
        image: tykio/tyk-gateway:v2.4.0
        ports:
            - "81:8080"
            - "8081:8080"
...
}

tyk_analytics.conf
{
…
“tyk_api_config”: {
“Host”: “http://tyk_gateway”,
“Port”: “8081”,
…
}

Can you share your tyk and analytics config too for me and i’ll see if I can spot anything obvious.

Cheers

Try this:

{
...
tyk_gateway:
        image: tykio/tyk-gateway:v2.4.0
        ports:
            - "80:8080"
            - "8081:8080"
...
}

I’m almost certain this is something to do with the way the host and container ports are being exposed but I don’t have anything to test on just this moment.

1 Like

Yes that’s correct. The issue was resolved when I reverted back to original 8080 port in tyk.conf:

{ "listen_port": 8080}

and tyk_analytics.conf:
{"Port": "8080"}