Get rid of ports in your docker development setup with Traefik.

When using docker in your development environment, it’s very easy to get tangled up in a web of port conflicts and frustrations. One of our engineers wrote a blog post on how to overcome this burden by using Traefik.

It saves us a bunch of frustration. You can read it on [our blog](https://madewithlove.com/blog/software-engineering/get-rid-of-ports-in-your-docker-development-setup-with-traefik/).

7 thoughts on “Get rid of ports in your docker development setup with Traefik.”

  1. I‘d suggest a wildcard DNS a entry that resolves to localhost. With you don‘t have to touch your hosts file.

    E.g. monitor.localhost.emcellsoft.de

    Reply
  2. > Add the apache.docker url to your hosts file so it points to 127.0.0.1

    Wait… so I have to add every new service I run to my local hosts file? That’s kinda lame.

    Reply
  3. Thank you, I just followed your guide and applied it to a few of my services like node-red, home-assistant, etc.

    To all those asking if you have to make a host file entry each time you add a service or to every host, I avoided this by adding in the A records into my domain name hosted externally. Say my home server runs off [192.168.0.1](https://192.168.0.1), I just created an A record called [nodered.example.com](https://nodered.myhome.com) pointing to [192.168.0.1](https://192.168.0.1).
    Then you just change this line: – traefik.http.routers.apache.rule=Host(\`nodered.example.com\`)
    This way every computer in my house can access nodered without host file changes.

    The other point I’d make is port 8080 was taken by Unifi device discovery. So I could not run it as you did in your blog. I changed – traefik.port=8080 to – traefik.port=8081 and the port above to 8081

    Hope that helps anyone else looking to do this.

    Reply
  4. As a FYI, you can dump the Traefik config file also, and specify command line parameters in the docker-compose. Eg.

    traefik:
    image: “traefik:v2.2”
    container_name: “traefik”
    command:
    – “–api.insecure=true”
    – “–api.dashboard=true”
    – “–providers.docker=true”
    – “–providers.docker.exposedbydefault=false”

    Reply

Leave a Comment