- Clean up previous Lab. Open you Terminal window and change to the
01-Traefik-Overview
directory. Stop the previous section Labdocker-compose stop
- Change to the
02-Configure-Traefik
folder - Open the
docker-compose.file.yml
file in your favorite editor and review how Docker starts Traefik using the file configuration - From the
02-Traefik-Overview
directory execute this command ->docker-compose -f docker-compose.file.yml up -d
- Review the logs output
docker-compose -f docker-compose.file.yml logs
- Stop and clean-up
docker-compose -f docker-compose.file.yml stop
################################################################
# API and dashboard configuration
################################################################
api:
# Dashboard
#
#
dashboard: true
################################################################
# Docker configuration backend
################################################################
providers:
docker:
watch: false
exposedByDefault: false
swarmMode: true
################################################################
# Traefik Logging
################################################################
log:
level: INFO
- Open the
docker-compose.cli.yml
file in your favorite editor and review how Docker starts Traefik using the CLI configuration - From the
02-Configure-Traefik
directory execute this command ->docker-compose -f docker-compose.cli.yml up -d
- Review the logs output
docker-compose -f docker-compose.cli.yml logs
- Stop and clean-up
docker-compose -f docker-compose.cli.yml stop
services:
traefik:
# The latest official supported Traefik docker image
image: traefik:v2.3
# Enables the Traefik Dashboard and tells Traefik to listen to docker
# --providers tell Traefik to connect to the Docker provider
# enable --log.level=INFO so we can see what Traefik is doing in the log files
command:
- "--api.insecure=true"
- "--providers.docker"
- "--log.level=INFO"
- Open the
docker-compose.env.yml
file in your favorite editor and review how Docker starts Traefik using the Environment configuration - From the
02-Configure-Traefik
directory execute this command ->docker-compose -f docker-compose.env.yml up -d
- Review the logs output
docker-compose -f docker-compose.env.yml logs
- Stop and clean-up
docker-compose -f docker-compose.env.yml stop
services:
traefik:
# The latest official supported Traefik docker image
image: traefik:v2.3
# Enables the Traefik Dashboard and tells Traefik to listen to docker
# --providers tell Traefik to connect to the Docker provider
# enable --log.level=INFO so we can see what Traefik is doing in the log files
environment:
- TRAEFIK_API_INSECURE=true
- TRAEFIK_PROVIDERS_DOCKER=true
- TRAEFIK_LOG_LEVEL=INFO
In this section, we will start using Docker Swarm. Ensure you have followed the Prerequisites from the Lab Setup. This can be found in the Getting Started Section of the course if you need to revisit. If you have any issues please add a comment in the course.
We use the docker stack deploy -c <compose file name> <user provided stack name>
command to deploy Swarm services. docker stack ps <stack name>
is used to check if all services are running in the stack. Finally, docker stack rm <stack name>
removes the entire stack.
To check logs on a running service, docker service ls
to retrieve the name of the service and docker service logs <service name>
to vier it's logs.
Further Docker information can be found here for Docker Stack or Docker services
- Open the
traefik-entrypoints.yml
anddocker-compose.configuration.yml
files in your favorite editor and review how Entrypoints are created and how we are using the YML file in this Lab. - From the
02-Configure-Traefik
directory execute this command ->docker stack deploy -c docker-compose.configuration.yml catapp
- Open the Traefik Dashboard http://0.0.0.0:8080 and review how the test service
catapp
is configured with Entrypoints. - Review the
catapp@docker
router andcatapp@docker
service in the Traefik Dashboard - Test the newly deployed
catapp
service http://catapp.localhost/ - Stop and clean-up
docker stack rm catapp