Last active
October 30, 2019 06:49
-
-
Save hmldd/53b01d6ae4d39b81c9267a7d9e1cf818 to your computer and use it in GitHub Desktop.
Revisions
-
hmldd revised this gist
Oct 30, 2019 . 3 changed files with 25 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,4 +6,6 @@ whoami地址:http://whoami.docker.localhost web UI地址:http://localhost:8080 traefik API原始数据地址:http://localhost:8080/api/rawdata Nginx地址:http://web.docker.localhost This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,13 +1,13 @@ version: '3' services: gateway: # 官方最新的 traefik docker 镜像 image: traefik:latest # 停止后重新启动 restart: unless-stopped # 开启 traefik web UI 界面并监听 docker command: - --api.insecure=true - --providers.docker ports: @@ -19,7 +19,19 @@ services: # 绑定 docker.sock 使 traefik 能够监听 docker 事件 - /var/run/docker.sock:/var/run/docker.sock whoami: image: containous/whoami # 通过 IP 地址或域名提供一个容器的服务 labels: - "traefik.http.routers.whoami.rule=Host(`whoami.docker.localhost`)" nginx: image: nginx:latest restart: unless-stopped # 绑定 web 文件目录和 nginx 配置目录 volumes: - ./web:/web:ro - ./config/nginx/vhost.conf:/etc/nginx/conf.d/vhost.conf # 解决 docker 容器中的 bash 前台执行外部命令时不接收 signal 的问题 command: "/bin/sh -c 'while :; do sleep 6h; nginx -s reload; done & exec nginx -g \"daemon off;\"'" # 通过 IP 地址或域名访问 labels: - "traefik.http.routers.nginx.rule=Host(`web.docker.localhost`)" This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ # Nginx静态文件服务器配置 server { server_name web.docker.localhost; root /web; } -
hmldd revised this gist
Oct 30, 2019 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,9 @@ 启动:`docker-compose up -d` 启动两个whoami实例:`docker-compose up -d --scale whoami=2` whoami地址:http://whoami.docker.localhost web UI地址:http://localhost:8080 traefik API原始数据地址:http://localhost:8080/api/rawdata -
hmldd created this gist
Oct 30, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ 启动:`docker-compose up -d` 启动两个whoami实例:`docker-compose up -d --scale whoami=2` whoami地址:http://whoami.docker.localhost web UI地址:http://localhost:8080 traefik API原始数据地址:http://localhost:8080/api/rawdata This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ version: '3' services: proxy: # 官方最新的 traefik docker 镜像 image: traefik:latest # 停止后重新启动 restart: unless-stopped # 开启 traefik web UI 界面并监听 docker command: - --api.insecure=true - --providers.docker ports: # HTTP 端口 - "80:80" # Web UI 端口(通过 --api.insecure=true 开启) - "8080:8080" volumes: # 绑定 docker.sock 使 traefik 能够监听 docker 事件 - /var/run/docker.sock:/var/run/docker.sock whoami: # 通过 IP 地址或域名提供一个容器的服务 image: containous/whoami labels: - "traefik.http.routers.whoami.rule=Host(`whoami.docker.localhost`)"