Post

Docker Compose - Common Variables

Compose içinde .env dosyası kullanmadan ortak değişkenler oluşturabileceğimiz bir alternatif olan common-variables örneğini paylaşıyorum. Şurada köşede dursun.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
x-common-variables: &common-variables
  TZ: Europe/Istanbul
  POSTGRES_USER: pgUser
  POSTGRES_PASSWORD: pgPassword
  POSTGRES_DB: testdb
  RABBITMQ_DEFAULT_USER: rabbitUser
  RABBITMQ_DEFAULT_PASS: rabbitPassword

services:
  postgres:
    image: postgres:16
    environment:
      <<: *common-variables
    ports:
      - 5432:5432

  rabbitmq3b:
    image: rabbitmq:3-management
    environment:
      <<: *common-variables
    ports:
      - 5672:5672
      - 15672:15672
This post is licensed under CC BY 4.0 by the author.