docker-compose.yml
version: '3' services: reverse-proxy: # The official v2.0 Traefik docker image image: traefik:v2.0 # Enables the web UI and tells Traefik to listen to docker command: --api.insecure=true --providers.docker ports: # The HTTP port - "80:80" # The Web UI (enabled by --api.insecure=true) - "8080:8080" volumes: # So that Traefik can listen to the Docker events - /var/run/docker.sock:/var/run/docker.sock # 启动 docker-compose up -d reverse-proxy # docker-compose: command not found # # pip install --upgrade pip # pip install docker-compose # # pip install more-itertools==5.0.0 #-bash: pip: command not found # yum -y install python-setuptools # wget https://bootstrap.pypa.io/get-pip.py # python3 -m pip install --upgrade pip
|
访问 页面结果:# http://172.16.0.1:8080/api/rawdata
正在上传…重新上传取消
正在上传…重新上传取消
正在上传…重新上传取消
[root@master2 ccc]# curl -H Host:whoami.docker.localhost http://127.0.0.1
Hostname: 796a63378844
IP: 127.0.0.1
IP: 172.17.0.3
RemoteAddr: 172.17.0.2:34798
GET / HTTP/1.1
Host: whoami.docker.localhost
User-Agent: curl/7.29.0
Accept: */*
Accept-Encoding: gzip
X-Forwarded-For: 172.17.0.1
X-Forwarded-Host: whoami.docker.localhost
X-Forwarded-Port: 80
X-Forwarded-Proto: http
X-Forwarded-Server: 82ee194c5f29
X-Real-Ip: 172.17.0.1
Traefik负载平衡
正在上传…重新上传取消
正在上传…重新上传取消
正在上传…重新上传取消