title: Configure Traefik in front of two docker containers, all on port 80
body: <p>I try to run three docker containers on one host. Traaefik is one of the containers to proxy traffic to the other containers.</p>
  
  <p>My first goal is to reach each container through a dedicated hostname on port 80. Traefik ui should be available only through a hostname and on port 80 also, having some sort of authentication.</p>
  
  <p>Using only a docker-compose.yml, I can reach all three containers using the hostnames, all on port 80. But to add authentication, I guess I need to introduce a traefik.toml. But this gives me troubles.
  Next goal would be to introduce SSL using let's encrypt on all three hosts.But first things first...</p>
  
  <p>Working solution with three hosts, all on port 80, lacking authorization for Traefik UI:</p>
  
  <pre><code>version: "2"
  
  networks:
   web:
  
  services:
  
   prox:
      image: containous/traefik:latest # The official Traefik docker image
      command: --api --docker # Enables the web UI and tells Træfik to listen to docker
      restart: unless-stopped
      ports:
        - "80:80"     # The HTTP port
      labels:
        - "traefik.port=8080"
        - "traefik.backend=traefikception"
        - "traefik.frontend.rule=Host:traefik.test.com"
        - "traefik.enable=true"
      volumes:
        - /var/run/docker.sock:/var/run/docker.sock # So that Traefik can listen to the Docker events
      networks:
        - web
  
   seafile_1:
      image: seafileltd/seafile
      container_name: seafile_1
      restart: unless-stopped
      environment:
        SEAFILE_ADMIN_EMAIL: me@test.com
        SEAFILE_ADMIN_PASSWORD: ####
        SEAFILE_SERVER_HOSTNAME: 1.test.com
      labels:
        - traefik.enable=true
        - traefik.frontend.rule=Host:1.test.com
        - traefik.port=80
        - traefik.backend=seafile_1
        - traefik.docker.network=web
      volumes:
        - /opt/seafile-data/ttt_1:/shared
      networks:
        - web
  
   seafile_2:
      image: seafileltd/seafile
      container_name: seafile_2
      restart: unless-stopped
      environment:
        SEAFILE_ADMIN_EMAIL: me@test2.com
        SEAFILE_ADMIN_PASSWORD: #####
        SEAFILE_SERVER_HOSTNAME: 2.test2.com
      labels:
        - traefik.enable=true
        - traefik.frontend.rule=Host:2.test2.com
        - traefik.port=80
        - traefik.backend=seafile_1
        - traefik.docker.network=web
      volumes:
        - /opt/seafile-data/ttt_2:/shared
      networks:
        - web
  </code></pre>
  
  <p>Adding the following traefik.toml:</p>
  
  <pre><code>defaultEntryPoints = ["http"]
  
  [entryPoints]
    [entryPoints.http]
    address = ":80"
  
   [entryPoints.proxy]
     address=":80"
     [entryPoints.proxy.auth]
       [entryPoints.proxy.auth.basic]
         users = [
           "joh:$apr1$RKdHyOKO$QDK1EKB4UJbsda7CXfPfK0",
         ]
  
  [api]
  entrypoint="proxy"
  </code></pre>
  
  <p>I get lot's of the following errors in the log, none of the containers is reachable from outside:</p>
  
  <pre><code>prox_1           | time="2018-06-17T19:23:26Z" level=fatal msg="Error preparing server: listen tcp :8080: bind: address already in use"
  prox_1           | time="2018-06-17T19:24:26Z" level=error msg="Error opening listener listen tcp :8080: bind: address already in use"
  prox_1           | time="2018-06-17T19:24:26Z" level=fatal msg="Error preparing server: listen tcp :8080: bind: address already in use"
  </code></pre>
  
  <p>I am pretty sure I need to adapt my docker-compose.yml and move settings to traefik.toml, but I cannot get my head around how to to that.</p>
  
  <p>Thanks in advance!! </p>