docker-compose dynamic volume names for replicas
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
- #14188 của @NAVEENKUMARKR777 — đã đóng, không merge
Đá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
- Ít trao đổi
- Công nghệ
- docker, docker-compose, yaml
- Lĩnh vực
- devops, infrastructure
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện hai ví dụ đã được ghi chép với Docker Compose v2.2.1, sử dụng các đoạn docker-compose.yml được cung cấp và các lệnh docker-compose up configsvr0 đã nêu. Đọc cách Compose xử lý các replica của service và tên volume; được xem là hoàn tất khi một volume được khai báo duy nhất có thể tạo ra các tên hợp lệ cho từng replica mà không cần sao chép các mục service hoặc volume.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
moved over from https://github.com/moby/moby/issues/43079
Tried some of the "solutions" from this thread and stackoverflow. No swarm, node or other hosts at all. Just trying to get it to work locally first without starting containers around docker-compose. Main idea is to get rid of these copies and just use replicas:
configsvr0:
image: mongo
command: mongod --configsvr --replSet configsvr --port 27017 --dbpath /data/db --keyFile /data/keyfile
volumes:
- configsvr0:/data/db
- ./keyfile:/data/keyfile:ro
configsvr1:
image: mongo
command: mongod --configsvr --replSet configsvr --port 27017 --dbpath /data/db --keyFile /data/keyfile
volumes:
- configsvr1:/data/db
- ./keyfile:/data/keyfile:ro
configsvr2:
image: mongo
command: mongod --configsvr --replSet configsvr --port 27017 --dbpath /data/db --keyFile /data/keyfile
volumes:
- configsvr2:/data/db
- ./keyfile:/data/keyfile:ro
volumes:
configsvr0:
configsvr1:
configsvr2:
See the difference? It's just counting up on the volume name...
It would be great to just have something like this:
configsvr0:
image: mongo
command: mongod --configsvr --replSet configsvr --port 27017 --dbpath /data/db --keyFile /data/keyfile
volumes:
- configsvr:/data/db
- ./keyfile:/data/keyfile:ro
volumes:
configsvr:
name: 'configsvr-{{.Task.Slot}}'
Tried this (see below) but it didn't work.
Note: Below I only copied small junks from my yml that I thought are important for this.
test 1 - volume name
would require to add entries under volumes so that's not really dynamic - but I gave it a try:
volumes:
- "configsvr{{.Task.Slot}}:/data/db"
➜ msc git:(develop) ✗ docker-compose up configsvr0
service "configsvr0" refers to undefined volume configsvr{{.Task.Slot}}: invalid compose project
test2 - dynamic name with task slot
that would be dynamic but still doesn't work though it was accepted in stackoverflow. That's actually my sample from top.
volumes:
- configsvr:/data/db
volumes:
configsvr:
name: 'configsvr-{{.Task.Slot}}'
➜ msc git:(develop) ✗ docker-compose up configsvr0
[+] Running 0/0
⠿ Volume "configsvr-{{.Task.Slot}}" Error 0.0s
Error response from daemon: create configsvr-{{.Task.Slot}}: "configsvr-{{.Task.Slot}}" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path
my env
mac monteray with docker desktop.
➜ msc git:(develop) ✗ docker -v
Docker version 20.10.11, build dea9396
➜ msc git:(develop) ✗ docker-compose -v
Docker Compose version v2.2.1
docker-compose.yml version: 3.9
- 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
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của docker/compose
-
[BUG] `docker compose port` prints `:0` (exit 0) for a port the image exposes but the service does not publishCó thể đã có người làm @ndeloof đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
docker/compose#14435 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] deploy.restart_policy without condition drops the restart policyCó thể làm lại được @akshat-lakhera đã nhận 25 ngày trước và không có pull request nào đang mở. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
docker/compose#14383 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] up: an optional (required: false) service_healthy dependent is not started when a required dependent shares the failing waitCó thể đã có người làm @ndeloof đã nhận 2 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 58/100
docker/compose#14507 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] Negative replica count in scale flags (docker compose scale / --scale) is accepted without validationCó thể đã có người làm @arsalanyavari đã nhận 8 ngày trước. Đang mởkind/bug status/approved
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 30/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của docker/compose
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
fluxcd/notification-controller#1441 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
OneBusAway/maglev#2145 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
priority/medium status/ready type/chore
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
discobox-ai/discobox#1357 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
TestPseudoLocaleRemote fails now and then: it types the code before the laptop asks for itCó thể đã có người làm @fzn0x đã nhận hôm nay. Đang mởbug priority: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
edit_file diff rendering panics on invalid UTF-8 textCó thể đã có người làm @TDnorthgarden đã nhận hôm nay. Đang mởarea/tui
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
docker/docker-agent#4955 ·
Maintainer thường phản hồi trong vòng 1 ngày