Quick start guide - gateway timeout

I tried to follow the Quick start guide from here:

I created 2 docker-compose.yml files in 2 directories:

version: '3'

services:
        reverse-proxy:
                image: traefik:v2.2
                command: --api.insecure=true --providers.docker --log.level=DEBUG
                ports:
                        - "80:80"
                        - "8080:8080"
                volumes:
                        - /var/run/docker.sock:/var/run/docker.sock

and

whoami:
        image: containous/whoami
        labels:
                - "traefik.http.routers.whoami.rule=Host(`whoami.docker.localhost`)"

Output of the docker-compose up in screenshot (sorry, but forum does not allow me tu put the log inline as it is detected as containing more than 4 links)

Respectively:

root@george-ubuntu-srv:/opt/traefik/whoami# docker-compose up
Creating whoami_whoami_1 ... done
Attaching to whoami_whoami_1
whoami_1 | Starting up on port 80

When I try

curl -H Host:whoami.docker.localhost http://127.0.0.1
Gateway Timeout

I get a gateway timeout. It seems that nothing reaches traefik container - nothing is printed in the logs on curl.

Please let me know if I miss anything or if I can provide any other info.

By putting those in two different compose files you put them in two different networks, but you did not supply any network configuration. Because of this traefik cannot reach whoami, and you see what you are seeing. Put them in a single docker-compose, or configure networking properly (refer to docker and traefik documentation for this).

As a side note, a better way of supplying logs is pasting them to gist or a pastebin and linking that up here. Your picture unfortunately is almost useless, as end of lines are cut, and one cannot search it easily.

1 Like

Thank you so much zespri.

I created only one yml file and this solved the problem.