Search code examples
dockertraefik

Testing traefik on play-with-docker.com


I tried to test and play around with traefik on play-with-docker.com before running it on my own private server.

However i could not get a simple example with 2 containers to work, see my docker-compose.yml file below. The containers both starts with up without any errors in their logs. I can see the traefik dashboard on port 80 with the subpath /traefik. But i cannot see dozzle on port 80 with the subpath /dozzle.

What is wrong with my configuration? Or does traefik not work properly on play-with-docker.com at all?

If i uncomment the ports section, i can see dozzle on port 8083 - but that is not what i want, then i am bypassing traefik...

Thanks for all hints...

---
version: '3.5'

networks:
  proxy:
    name: proxy
    driver: bridge
  web:
    name: web
    driver: bridge

services:
  traefik:
    image: traefik
    container_name: traefik
    restart: always
    command:
      - "--logLevel=INFO"
      - "--api"
      - "--defaultentrypoints=http"
      - "--docker"
      - "--docker.watch"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    networks:
      - proxy
      - web
    ports:
      - "80:80"
    labels:
    - "traefik.enable=true"
    - "traefik.backend=traefik"
    - "traefik.frontend.rule=PathPrefixStrip:/traefik"
    - "traefik.port=8080"
    - "traefik.docker.network=proxy"

  dozzle:
    image: amir20/dozzle
    container_name: dozzle
    restart: always
    depends_on:
      - traefik
    command:
      - "--level=DEBUG"
      - "--base=/dozzle"
      - "--addr=:8083"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    # ports:
    #   - 8083:8083
    networks:
      - proxy
    labels:
    - "traefik.enable=true"
    - "traefik.backend=dozzle"
    - "traefik.frontend.rule=PathPrefixStrip:/dozzle"
    - "traefik.port=8083"
    - "traefik.docker.network=proxy"

EDIT 13.07.2019 - additional informations

I tried a simplified version of the compose file on my local machine with Docker Toolbox. Still the same issue. If i am on http://192.168.99.100/dozzle i get a blank white page and on http://192.168.99.100 i get an 404 error.

This is the simplified version:

---
version: '3.5'

services:

  traefik:
    image: traefik
    container_name: traefik
    restart: always
    command:
      - "--docker"
    ports:
      - "80:80"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

  dozzle:
    image: amir20/dozzle
    container_name: dozzle
    restart: always
    depends_on:
      - traefik
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    labels:
      - "traefik.enable=true"
      - "traefik.frontend.rule=PathPrefixStrip:/dozzle"
      - "traefik.port=8080"

The blank page i get on http://192.168.99.100/dozzle contains a HTML page, if i am switching to source code view in the browser. However just a blank white page is shown. I assume that the relative links within the HTML code could not be resolved and therefore no css, js etc. could be loaded.


Solution

  • If I undersand the dozzle command line option "--base=/doozle", the backend should be reached through the path

    :8083/dozzle

    But in your frontend rule, you remove / strip the "/doozle" from the initial request :

    "traefik.frontend.rule=PathPrefixStrip:/dozzle"
    

    Thus, your should only use PathPrefix instead.