No variable substitution in service names

Đang mở
#10,994 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
docker-compose, go
Lĩnh vực
devops

Hướng nghiên cứu

Tái hiện trường hợp này với abstract-service.yaml, service.env và docker-compose.yaml bằng cách chạy docker compose config. Xem xét cách các đầu vào include và env_file được xử lý, sau đó xác định và xác minh hành vi trong đó tên service trở thành fancy và đối số build của nó là APP_NAME=fancy.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

kind/feature
Description

In 2016 there was a bug-report or feature request with the same title as this one. link At the time it wasn't resolved as the issue seemed to be resolved better by using the compose project name. Since then the include element has been added and I think this might be worth reconsidering.

I ran in to this because I'd like to define a few template services so I wrote the following file (shortened for brevity):

# abstract-service.yaml
services:
  "$APP_NAME":
    build: { args: [ "APP_NAME=${APP_NAME}" ] }
# service.env
APP_NAME=fancy
# docker-compose.yaml
include:
  - path: ./abstract-service.yaml
    env_file: ./service.env

services: { }

Then running docker compose config I'd expect something along these lines:

services:
  fancy:
    build: { args : [ "APP_NAME=fancy" ] }

Obviously this doesn't work and throws a rather predictable validating /.../docker-compose-gist/abstract-service.yaml: services Additional property $APP_NAME is not allowed

Gist for convenience: link

Ngôn ngữ chính
Go
Star
38.9k
Fork
6k
Merge trung bình
2 ngày 22 giờ
Pull request đã merge (30 ngày)
81

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của docker/compose

Tất cả issue của docker/compose

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.