I have used vmware to build a ubuntu server,and traefik is on the ubuntu's docker.I can use traefik to reverse proxy any services on the same docker.But when comes to other machines' services,it won't do a thing.
Here are all the config files.
traefik.yml:
global:
checkNewVersion: true
sendAnonymousUsage: false
log:
level: DEBUG
filePath: /etc/traefik/logs/traefik.log
accessLog:
filePath: /etc/traefik/logs/traefik-access.log
api:
dashboard: true
debug: true
entryPoints:
web:
address: :80
providers:
docker:
exposedByDefault: false
watch: true
file:
filename: /config.yml
directory: /etc/traefik
watch: true
docker-compose.yml:
version: "3"
services:
traefik:
image: traefik:latest
container_name: traefik
restart: unless-stopped
security_opt:
- no-new-privileges:true
networks:
- "test"
ports:
- 80:80
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /etc/localtime:/etc/localtime:ro
- /home/me/docker/traefik:/etc/traefik
- /home/me/docker/traefik/config.yml:/config.yml
- /home/me/docker/traefik/logs:/etc/traefik/logs
labels:
- 'traefik.enable=true'
- 'traefik.http.routers.traefik.entrypoints=web'
- 'traefik.http.routers.traefik.rule=Host(`traefik.test.lan`)'
- 'traefik.http.routers.traefik.service=api@internal'
networks:
test:
external: true
Another container on the same docker
version: "3"
services:
nginx:
image: nginx:latest
container_name: nginx
restart: unless-stopped
networks:
- "test"
ports:
- 180:80
volumes:
- /home/me/docker/nginx/conf.d:/etc/nginx/conf.d
labels:
- 'traefik.enable=true'
- 'traefik.http.routers.nginx.entrypoints=web'
- 'traefik.http.routers.nginx.rule=Host(`nginx.test.lan`)'
config.yml
http:
routers:
app:
entryPoints:
- web
rule: "Host(`app.test.lan`)"
service: app
services:
app:
loadBalancer:
servers:
- url: "http://192.168.0.191:1235"
Ubuntu‘s ip address is 192.168.0.130.Network test is using bridge mode.
I can visit traefik's dashboard and nginx's site.And I can see app in http router,but when I visit it,it will time out.
Plaese help me.