Juan Treminio
Juan Treminio

Reputation: 2178

Traefik with Docker on OSX - Gateway Timeout following official instructions

Following these instructions: https://docs.traefik.io/#test-it

I start with default networks:

$ docker network ls
NETWORK ID          NAME                DRIVER              SCOPE
dc218a8c3b42        bridge              bridge              local
061dad0019b0        docker_gwbridge     bridge              local
25e18684046a        host                host                local
29da4987a368        none                null                local

and no other containers:

$ docker container ls -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

The traefik container comes up fine:

$ docker-compose up -d
Creating network "testproject_webgateway" with driver "bridge"
Creating testproject_proxy_1 ... done

The emilevauge/whoami container has a small network issue:

$ docker-compose up -d
ERROR: Network traefik_webgateway declared as external, but could not be found. Please create the network manually using `docker network create traefik_webgateway` and try again.

So I manually create it:

$ docker network create traefik_webgateway
2ee51f3bbd603984a056da6269775d50ab5549fe85c3caf457f4933bf0e97ffe

and rerun:

$ docker-compose up -d
Creating test_whoami_1 ... done

At this point I am able to access the Traefik web UI and see the single whoami container:

traefik web ui with single whoami container

Finally I attempt to run the curl command, but receive a gateway timeout error:

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

The traefik container logs show this for the above:

time="2018-02-10T23:38:47Z" level=debug msg="vulcand/oxy/roundrobin/rr: begin ServeHttp on request" Request="{"Method":"GET","URL":{"Scheme":"","Opaque":"","User":null,"Host":"","Path":"/","RawPath":"","ForceQuery":false,"RawQuery":"","Fragment":""},"Proto":"HTTP/1.1","ProtoMajor":1,"ProtoMinor":1,"Header":{"Accept":["*/*"],"User-Agent":["curl/7.50.3"]},"ContentLength":0,"TransferEncoding":null,"Host":"whoami.docker.localhost","Form":null,"PostForm":null,"MultipartForm":null,"Trailer":null,"RemoteAddr":"172.18.0.1:55380","RequestURI":"/","TLS":null}"
time="2018-02-10T23:38:47Z" level=debug msg="vulcand/oxy/roundrobin/rr: Forwarding this request to URL" Request="{"Method":"GET","URL":{"Scheme":"","Opaque":"","User":null,"Host":"","Path":"/","RawPath":"","ForceQuery":false,"RawQuery":"","Fragment":""},"Proto":"HTTP/1.1","ProtoMajor":1,"ProtoMinor":1,"Header":{"Accept":["*/*"],"User-Agent":["curl/7.50.3"]},"ContentLength":0,"TransferEncoding":null,"Host":"whoami.docker.localhost","Form":null,"PostForm":null,"MultipartForm":null,"Trailer":null,"RemoteAddr":"172.18.0.1:55380","RequestURI":"/","TLS":null}" ForwardURL=http://172.20.0.2:80
time="2018-02-10T23:38:47Z" level=debug msg="vulcand/oxy/forward: begin ServeHttp on request" Request="{"Method":"GET","URL":{"Scheme":"http","Opaque":"","User":null,"Host":"172.20.0.2:80","Path":"","RawPath":"","ForceQuery":false,"RawQuery":"","Fragment":""},"Proto":"HTTP/1.1","ProtoMajor":1,"ProtoMinor":1,"Header":{"Accept":["*/*"],"User-Agent":["curl/7.50.3"]},"ContentLength":0,"TransferEncoding":null,"Host":"whoami.docker.localhost","Form":null,"PostForm":null,"MultipartForm":null,"Trailer":null,"RemoteAddr":"172.18.0.1:55380","RequestURI":"/","TLS":null}"
time="2018-02-10T23:38:47Z" level=debug msg="vulcand/oxy/forward/http: begin ServeHttp on request" Request="{"Method":"GET","URL":{"Scheme":"http","Opaque":"","User":null,"Host":"172.20.0.2:80","Path":"","RawPath":"","ForceQuery":false,"RawQuery":"","Fragment":""},"Proto":"HTTP/1.1","ProtoMajor":1,"ProtoMinor":1,"Header":{"Accept":["*/*"],"User-Agent":["curl/7.50.3"]},"ContentLength":0,"TransferEncoding":null,"Host":"whoami.docker.localhost","Form":null,"PostForm":null,"MultipartForm":null,"Trailer":null,"RemoteAddr":"172.18.0.1:55380","RequestURI":"/","TLS":null}"

I'm unsure if I am supposed to do anything else here.

I don't have a concrete answer, but upgrading to macOS 10.13.x fixed the issue.

Upvotes: 1

Views: 3411

Answers (1)

iamgerwin
iamgerwin

Reputation: 23

I had also issue on using Traefik on my personal macbook compared to my workstation on my office that's running on Ubuntu...

Here's my reference... https://docs.traefik.io/#test-it

First you want to use the docker way of using Traefik start docker compose file Get the default network that's also listed on the terminal. Second on your project's docker compose file add this on your yml file. docker-compose.yml file

One more thing, please don't forget to add your desired domain on your /etc/hosts/ file. my sample /etc/hosts file.

Hopefully, it would help!

Upvotes: 1

Related Questions