Linux command
traefik 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Start Traefik
traefik
Start with a specific config file
traefik --configFile=[traefik.yml]
Enable Docker provider
traefik --providers.docker
Enable Docker with specific endpoint
traefik --providers.docker.endpoint=unix:///var/run/docker.sock
Set entrypoint
traefik --entrypoints.web.address=:80
Enable the API dashboard
traefik --api.dashboard=true
Check health status
traefik healthcheck
Display help
traefik --help
说明
Traefik is a modern HTTP reverse proxy and load balancer designed for microservices. It automatically discovers services through providers like Docker, Kubernetes, and Consul, and configures routing rules dynamically. Key features include automatic HTTPS with Let's Encrypt, load balancing, circuit breakers, rate limiting, and metrics. Configuration can be provided via files (YAML, TOML), environment variables, or command-line flags. The web dashboard provides real-time visibility into routers, services, and middlewares. Traefik integrates natively with container orchestrators and service meshes.
参数
- --configFile _file_
- Load configuration from specified file (traefik.yml, traefik.toml).
- --providers.docker
- Enable Docker provider for automatic service discovery.
- --providers.docker.endpoint _endpoint_
- Docker daemon endpoint (e.g., unix:///var/run/docker.sock).
- --providers.file.filename _file_
- Enable file provider with configuration file.
- --entrypoints._name_.address _address_
- Define entrypoint address (e.g., :80, :443).
- --api.dashboard
- Enable the web dashboard.
- --api.insecure
- Allow insecure access to API (for development).
- --log.level _level_
- Log level: DEBUG, INFO, WARN, ERROR.
- --accesslog
- Enable access logging.
- --certificatesresolvers._name_.acme.email _email_
- Email for Let's Encrypt certificates.
- healthcheck
- Check Traefik health via /ping endpoint.
- version
- Display version information.
- --help
- Display help message.
FAQ
What is the traefik command used for?
Traefik is a modern HTTP reverse proxy and load balancer designed for microservices. It automatically discovers services through providers like Docker, Kubernetes, and Consul, and configures routing rules dynamically. Key features include automatic HTTPS with Let's Encrypt, load balancing, circuit breakers, rate limiting, and metrics. Configuration can be provided via files (YAML, TOML), environment variables, or command-line flags. The web dashboard provides real-time visibility into routers, services, and middlewares. Traefik integrates natively with container orchestrators and service meshes.
How do I run a basic traefik example?
Run `traefik` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --configFile _file_ do in traefik?
Load configuration from specified file (traefik.yml, traefik.toml).