qoomon / docker-host

A docker sidecar container to forward all traffic to local docker host or any other host
MIT License
1.1k stars 88 forks source link

Gateway timeout #25

Closed lrkwz closed 5 years ago

lrkwz commented 5 years ago

I cannot make the gateway work properly. I've read #21 and bound my app to the host ip 172.20.0.1 (resulting from docker network inspect bridge --format='{{( index .IPAM.Config 0).Gateway}}').

Relevant part of docker-compose.yml is:

version: '3'
services:
    my-api-gateway:
        image: qoomon/docker-host
        cap_add: [ 'NET_ADMIN', 'NET_RAW' ]
        # mem_limit: 4M
        restart: on-failure
    web:
        image: my-webapp-ui
        ports:
        - "80:80"

Then I start the java api mvn spring-boot:run which listens on 172.20.0.1 port 8080.

From the host shell:

$ curl http://172.20.0.1:8080/management/health
{
  "status" : "UP"
}

From the goomon/docker-host container:

$ docker-compose exec my-api-gateway sh
# curl http://172.20.0.1:8080/management/health
{
  "status" : "UP"
} 

From the linked container:

$  docker-compose exec web sh
# curl http://my-api-gateway:8080/management/health
curl: (7) Failed to connect to my-api-gateway port 8080: Operation timed out

What's wrong in my config?

qoomon commented 5 years ago

Which host environment you're working with? Can you access the host by do curl http://172.20.0.1:8080/management/health from within web container? Can you ping my-api-gateway from within web container?

lrkwz commented 5 years ago

Working with ubuntu 18.04

Yes I can both curl the host ip and ping the gateway name.

No firewall in the way

qoomon commented 5 years ago

Strange. What are the logs of my-api-gateway when starting? Do you have the same problem when you try one of the example at https://github.com/qoomon/docker-host/blob/master/README.md

lrkwz commented 5 years ago

The logs where pretty normal:

Docker Host: 172.20.0.1 (default gateway)
Forwarding ports: 0:65535

I resolved dropping all the containers, removing all the docker-networks and start all over again. It must have been a mess with the "real" networks (eth, wifi) and docker's nets.

Sorry for bothering you.

qoomon commented 5 years ago

Glad to hear that.

On Sat, 7 Sep 2019, 18:48 Luca Orlandi, notifications@github.com wrote:

The logs where pretty normal:

Docker Host: 172.20.0.1 (default gateway) Forwarding ports: 0:65535

I resolved dropping all the containers, removing all the docker-networks and start all over again. It must have been a mess with the "real" networks (eth, wifi) and docker's nets

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/qoomon/docker-host/issues/25?email_source=notifications&email_token=AA6HUATBL4L6W2GER2QVF6LQIPLPRA5CNFSM4ITIN5LKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6E45XI#issuecomment-529125085, or mute the thread https://github.com/notifications/unsubscribe-auth/AA6HUASIKXXHVI2SSWIOPN3QIPLPRANCNFSM4ITIN5LA .