فحوص الصحة وترتيب البدء
في هذا الدرس 4 موضوعات
هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
make services start in a usable order.
الموضوعات المخطط لها
depends_onalone only waits for the container to start, not to be ready.- A
healthcheckruns a command repeatedly to mark a service healthy. depends_on: db: condition: service_healthymakes the app wait for a healthy database.- Postgres check:
pg_isready. Tuneinterval,timeout,retries. - Apps should still retry connections; startup order is a convenience, not a guarantee.
تفاصيل المخطط المبدئي
عرض عملي
db:
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
retries: 10
app:
depends_on:
db: { condition: service_healthy }اختبر فهمك
Why is plain depends_on not enough?
أظهر الإجابة
It does not wait until the database accepts connections.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.