dockerEnv/docker-compose.yml

100 lines
2.5 KiB
YAML

version: '3.8'
services:
consul:
image: consul
restart: always
container_name: consul
command: consul agent -server -dev -client=0.0.0.0 -ui -bootstrap -log-level warn -datacenter dev
environment:
SERVICE_8400_NAME: consul
SERVICE_8500_NAME: consul
SERVICE_8600_NAME: consul
SERVICE_8301_NAME: consul
SERVICE_8300_NAME: consul
SERVICE_8302_NAME: consul
ports:
- "8400:8400"
- "8500:8500"
- "8600:8600/udp"
expose:
- "8500"
networks:
- inbound
labels:
- "traefik.docker.network=inbound"
- "traefik.http.routers.consul.rule=Host(`consul.docker.localhost`)"
- "traefik.http.routers.consul.service=consul"
- "traefik.http.services.consul.loadbalancer.server.port=8500"
registrator:
restart: always
container_name: registrator
depends_on:
- consul
image: gliderlabs/registrator:master
command: -ttl=120 -ttl-refresh=10 -cleanup=true -resync=10 -internal consul://consul:8500
volumes:
- /var/run/docker.sock:/tmp/docker.sock
networks:
- inbound
links:
- consul
environment:
SERVICE_NAME: registrator
portainer:
restart: always
container_name: portainer
image: portainer/portainer-ce:latest
command: -H unix:///var/run/docker.sock
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./storage/portainer:/data
networks:
- inbound
labels:
- "traefik.docker.network=inbound"
- "traefik.http.routers.portainer.rule=Host(`portainer.docker.localhost`)"
- "traefik.http.routers.portainer.service=portainer"
- "traefik.http.services.portainer.loadbalancer.server.port=9000"
traefik:
image: traefik:latest
container_name: traefik
restart: always
networks:
- traefik
- inbound
volumes:
- ./configs/traefik.yml:/etc/traefik/traefik.yml
- /var/run/docker.sock:/var/run/docker.sock
ports:
- target: 80
published: 80
mode: host
- target: 443
published: 443
mode: host
- target: 8080
published: 8090
protocol: tcp
mode: ingress
labels:
- "traefik.http.routers.api.rule=Host(`traefik.docker.localhost`)"
- "traefik.http.routers.api.service=api@internal"
networks:
traefik:
driver: bridge
name: traefik
inbound:
driver: bridge
name: inbound
configs:
traefik_config:
file: ./configs/traefik.yml