Docker Compose Ağlarıyla Kapsayıcıları Bağlama
Docker Compose ile çok kapsayıcılı uygulamaları tanımlayın ve hizmet adlarını kullanarak otomatik oluşturulan bir köprü ağı üzerinden iletişim kurmalarını sağlayın.
Docker Compose Ağlarıyla Kapsayıcıları Bağlama, CoddyKit'te ücretsiz bir Docker & Kubernetes for Developers dersidir. Bu, 4 dersinin 4. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, Docker & Kubernetes for Developers öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Docker & Kubernetes for Developers kursu toplamda 4 dersten oluşur.
Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.
Why Compose for Networking
Running many containers and wiring their networks by hand is tedious. Docker Compose describes your whole stack in one YAML file and creates a dedicated network so services can find each other.
The Default Compose Network
When you run docker compose up, Compose creates a single user-defined bridge network for the project. Every service joins it automatically, so no manual docker network create is needed.
Service Names as Hostnames
On a Compose network, each service is reachable by its service name via built-in DNS. A service named db is reachable at the hostname db from any other service.
A Minimal Compose File
Two services on one network: a web app and a database.
version: "3.9"
services:
web:
image: myapp:latest
ports:
- "8080:80"
db:
image: postgres:16
environment:
POSTGRES_PASSWORD: secretConnecting to db by Name
Inside the web container, the connection string points to the service name, not an IP:
DATABASE_URL=postgres://postgres:secret@db:5432/postgresDefining Custom Networks
You can declare named networks to isolate groups of services.
services:
web:
image: myapp
networks: [frontend]
api:
image: myapi
networks: [frontend, backend]
db:
image: postgres
networks: [backend]
networks:
frontend:
backend:Network Isolation in Practice
In the example above, web can reach api but NOT db, because they share no network. This limits the blast radius if a frontend container is compromised.
Exposing vs Publishing Ports
expose makes a port reachable only to other containers on the network. ports publishes it to the host. Internal services like databases should usually only be exposed, never published.
Aliases for Services
You can give a service extra DNS names with aliases, handy when migrating from an old hostname.
services:
db:
image: postgres
networks:
backend:
aliases:
- database
- legacy-db
networks:
backend:Connecting to External Networks
Set a network as external: true to attach services to a network created outside this Compose file, sharing it across projects.
networks:
shared:
external: trueInspecting the Network
List and inspect the network Compose created to confirm which containers are attached.
docker network ls
docker network inspect myproject_defaultQuick Check
Test what you have learned.
Recap
You learned that Docker Compose creates a network per project, lets services talk by service name, and supports custom networks for isolation, expose vs ports, aliases, and external networks.
Sıkça Sorulan Sorular
“Docker Compose Ağlarıyla Kapsayıcıları Bağlama” dersi ücretsiz mi?
Evet — “Docker Compose Ağlarıyla Kapsayıcıları Bağlama” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve Docker & Kubernetes for Developers kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Docker & Kubernetes for Developers kursu toplamda 4 dersten oluşur.
“Docker Compose Ağlarıyla Kapsayıcıları Bağlama” dersinde ne öğreneceğim?
Docker Compose ile çok kapsayıcılı uygulamaları tanımlayın ve hizmet adlarını kullanarak otomatik oluşturulan bir köprü ağı üzerinden iletişim kurmalarını sağlayın. Docker & Kubernetes for Developers ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.
Docker & Kubernetes for Developers öğrenmeye başlamak için deneyim gerekli mi?
Önceden deneyim gerekmez. CoddyKit'te Docker & Kubernetes for Developers, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 4. dersidir.
“Docker Compose Ağlarıyla Kapsayıcıları Bağlama” dersi ne kadar sürer?
Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.
Bu Docker & Kubernetes for Developers dersinde kod yazıp çalıştırabilir miyim?
Evet. Her Docker & Kubernetes for Developers dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.
Bu kursun tüm dersleri
- Docker ağ türlerini anlama
- Konteyner ağlarını yapılandırma
- Birimlerle verilerin kalıcı tutulması
- Docker Compose Ağlarıyla Kapsayıcıları Bağlama