Giter Site home page Giter Site logo

traefik-docker-local's Introduction

Traefik for local dev

One time setup

Create the Docker network that all projects will use to communicate with Traefik:

docker network create traefik

Then cd into this directory and run:

docker-compose up -d

From this point forward Traefik will control ports 80 and 443 on the machine, listening to the Docker daemon for containers starting and stopping, and routing traffic to these containers as appropriate. The Traefik UI is exposed at http://localhost/traefik/.

Using with a docker-compose project

To use an external docker-compose project with this Traefik instance, include the following directives in your docker-compose.yml file:

version: "3.3"

networks:
  # This allows your services to communicate with the Traefik container over the
  # network we set up during the "One time setup" step
  traefik:
    external: true
  # An internal network is recommended to isolate ports your services expose
  internal:
    driver: bridge

services:
  EXAMPLE:
    # Make sure the HTTP service you wish to expose through Traefik is on the
    # `traefik` network, and optionally on your custom "internal" network
    networks:
      - traefik
      - internal
    # These labels are how Traefik configures itself for this container. See
    # https://docs.traefik.io/configuration/backends/docker/#on-containers
    # Note that the value for `HOSTNAME` is pulled from the environment
    # variables used when launching your project. The easiest way to define
    # these for your project is in an `.env` file (see the documentation at
    # https://docs.docker.com/compose/env-file/). Also, this example assumes
    # your code is listening for HTTP traffic on port 3000 - change if needed.
    labels:
      - "traefik.backend=EXAMPLE"
      - "traefik.docker.network=traefik"
      - "traefik.frontend.rule=Host:${HOSTNAME}"
      - "traefik.port=3000"

traefik-docker-local's People

Contributors

thirdender avatar

Watchers

 avatar  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.