Created
August 9, 2023 18:01
-
-
Save sephraim/b620025523bf1ded1c3098b0e314cbed to your computer and use it in GitHub Desktop.
[Docker Compose + Traefik] Reverse proxying + customizing localhost domains using Traefik
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 characters
services: | |
traefik: | |
image: traefik:2.10 | |
command: --api.insecure=true --providers.docker | |
ports: | |
- "80:80" | |
- "8080:8080" | |
volumes: | |
- /var/run/docker.sock:/var/run/docker.sock | |
rails1: | |
build: . | |
image: my-rails-app | |
container_name: rails1 | |
labels: | |
- "traefik.http.routers.rails1.rule=Host(`rails1.localhost`)" # access this app at rails1.localhost | |
env_file: .env | |
command: ['init_rails'] | |
volumes: | |
- .:/app | |
- ./scripts/docker/init_rails.sh:/bin/init_rails | |
depends_on: | |
- traefik | |
rails2: | |
build: . | |
image: my-rails-app | |
container_name: rails2 | |
labels: | |
- "traefik.http.routers.rails2.rule=Host(`rails2.localhost`)" # access this app at rails2.localhost | |
env_file: .env | |
command: ['init_rails'] | |
volumes: | |
- .:/app | |
- ./scripts/docker/init_rails.sh:/bin/init_rails | |
depends_on: | |
- traefik |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment