docker compose /app y traefik
pilasguru |
PRO |
06/16/25 07:35:41 PM UTC |
0 ⭐ |
5905 👁️ |
Never ⏰ |
[docker-compose, docker, compose, traefik]
# Traefik console 8080
# /app access 80
$ docker network create proxy
# ---
services:
traefik:
image: traefik:latest
command:
- "--api.insecure=true"
- "--providers.docker=true"
- "--entrypoints.web.address=:80"
ports:
- "80:80"
- "8080:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
networks:
- proxy
labels:
- "traefik.enable=false"
networks:
proxy:
external: true
# ---
services:
web:
image: nginx:latest
command: >-
bash -c "COLORS=('red' 'green' 'blue' 'yellow' 'cyan' 'magenta' 'orange' 'purple' 'pink' 'lime' 'teal' 'brown' 'gold' 'navy' 'olive' 'maroon' 'aqua' 'coral' 'salmon' 'violet');
COLOR=$${COLORS[$$RANDOM % $${#COLORS[@]}]};
echo \"<html><body style='background: $$COLOR; color: #ffffff; display: flex; align-items: center; justify-content: center; height: 100vh; margin: 0; font-size: 24px;'><h1>Mi color de fondo es $$COLOR</h1></body></html>\" > /usr/share/nginx/html/index.html && nginx -g 'daemon off;'"
labels:
- "traefik.enable=true"
- "traefik.http.routers.mi_servicio.rule=PathPrefix(`/app`)"
- "traefik.http.routers.mi_servicio.middlewares=strip-app"
- "traefik.http.middlewares.strip-app.stripprefix.prefixes=/app"
- "traefik.http.services.mi_servicio.loadbalancer.server.port=80"
deploy:
replicas: 3
networks:
- proxy
networks:
proxy:
external: true
Comments
0 B
|👍
/👎
0 B
|👍
/👎
0 B
|👍
/👎
0 B
|👍
/👎
0 B
|👍
/👎
0 B
|👍
/👎
0 B
|👍
/👎
0 B
|👍
/👎
0 B
|👍
/👎
0 B
|👍
/👎
0 B
|👍
/👎
0 B
|👍
/👎
0 B
|👍
/👎