Git Product home page Git Product logo

traefik-docker's Introduction

Traefik docker

Author

Maxim Antonisin
img img img

Requirements

img

Description

This repository provides a simple and easy-to-update configuration for running Traefik on Docker. With these config files, you can quickly create and launch a Traefik Docker container to act as a reverse proxy and load balancer for your projects. The main purpose of this repository is to have a single entry point for all your projects, accessible on default ports (e.g. 80, 443), so you can manage them all in one place and easily add or modify them.

In other words, the Traefik Docker container acts as a central hub, listening on ports 80 and 443, and directing traffic to other Docker containers running your various projects. This setup helps to avoid conflicts when running multiple containers on the same port and removes the need for including a port number in the URL.

Example:

HTTP Request (project1.test) 80 -> traefik_container -> project_container_1 
HTTP Request (project2.test) 80 -> traefik_container -> project_container_2

or

Internet
|
|  Request to project1.test
|  ------------------------------->
|
|  Traefik Docker Container
|  ------------------------------->
|
|  Project 1 Docker Container
|  ------------------------------->
|
|  Response to User
|  <-------------------------------

Installation

  1. Clone this repository.
    git clone <THIS_REPO_URL> 
  2. Make sure that ports 80 and 443 are free.
  3. Run docker-compose up -d
    docker-compose up -d

Usage

To create the connection and alias between a container and a domain or hostname, you need to add labels to your Docker Compose file for the relevant container/service. Here's an example:

version: '3.7'
services:
    frontend:
        build: node:14.15.4-alpine
        expose: [ 3000 ]
        labels:
            - traefik.enable=true
            - traefik.http.routers.mavic-frontend.rule=Host(`frontend.test`)
            - traefik.http.services.mavic-frontend.loadbalancer.server.port=3000
      

In this example, we have a frontend service that is running on port 3000. To allow Traefik to route traffic to this service, we need to expose the port and add the relevant labels. The labels specify the domain name for the service, which can be replaced with any desired value.

Support

sleepwalker Buy Me a Coffee at ko-fi.com

traefik-docker's People

Contributors

antonisin avatar

Stargazers

Victor Berestian avatar

Watchers

 avatar Victor Berestian avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.