Traefik
===Traefik setup example=== Guide For setting up Traefik Install latest docker-ce:
| |
Start the docker service and enable it to launch everytime at system boot.
| |
| |
Check version of docker:
| |
Additional: Running Docker for non-root user Docker container can be run under the non-root user. We just need to add the user to the docker group.
Add ‘aleks’ user.
| |
Now add the ‘aleks’ user to the docker group, then restart the docker service.
| |
| |
Test by running the docker hello-world.
| |
Install Docker Compose
| |
Check version:
| |
Create Custom Docker Network
Check the available docker network on the system.
| |
Configuration
To configure traefik in docker you will need to set a docker compose file and a static + dynamic configuration.
Docker-Compose config:
set a basic config in the docker-compose.yml file to create the traefik container and map the host ports to it:
| |
Add volumes into the container by mapping locations on the docker host into the traefik container(within the traefik block):
| |
Static + Dynamic configuration files
Configure the traefik configuration via files using the file provider. you can use the “traefik.yml” file mapped to the “/etc/traefik.traefik.yml” location in the container
Configure entrypoints in the file to map the ports exposed to the services that you will be running in the container:
| |
Enable the api of traefik which is a built in service that will run the dashboard and other handy things:
| |
Enable the providers that you will be using, eg docker for docker and file for configuration files:
| |
Create servers that are required, this is an example of an http server to run a router:
| |
Create the service that the router will route to:
| |
Dashboard configuration
Configure the dashboard like you would another server, using a router to route traffic to it and add in the options you want to use.
| |