Web TippsUse custom web fonts in Google Sheets charts(08.09.2026 um 17:05 Uhr)
Web TippsIntroducing the new 1Password App for Google Chat(08.09.2026 um 18:02 Uhr)
Web TippsUse custom web fonts in Google Sheets charts(08.09.2026 um 17:05 Uhr)
Web TippsIntroducing the new 1Password App for Google Chat(08.09.2026 um 18:02 Uhr)

🔧 Programmierung 🕛 vor 1 Jahr 3 Min Lesezeit
0

Day 11: Docker Compose

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

This is a crosspost from is a tool that helps you define and run multi-container applications. Instead of long docker commands, you write a YAML file that describes your entire application stack.



Let's convert our previous setup to a Docker Compose file. Create a new file called docker-compose.yml:




CODE
services:
api:
build: .
ports:
- "8080:8080"
environment:
- SECRET_MESSAGE=Hello Docker!
- PORT=8080
volumes:
- mydata:/data
networks:
- myapp-network
volumes:
mydata:
networks:
myapp-network:






Now instead of that long docker command, you can simply run:




CODE
docker compose up






Docker Compose will:




  1. Create the network

  2. Create the volume

  3. Build the image (if needed)

  4. Start the container with all specified configuration



To stop everything:




CODE
docker compose down






Let's add some more complexity to our application. We will add a database and a reverse proxy.




CODE
services:
api:
build: .
ports:
- "8080:8080"
environment:
- SECRET_MESSAGE=Hello Docker!
- PORT=8080
volumes:
- mydata:/data
networks:
- myapp-network
depends_on:
- db
db:
image: postgres
ports:
- "5432:5432"
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=myapp
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- myapp-network
nginx:
image: nginx
ports:
- "80:80"
networks:
- myapp-network
depends_on:
- api
volumes:
mydata:
postgres_data:
networks:
myapp-network:






What we did here is:




  • Added a database service

  • Added a reverse proxy service

  • Added a dependency to the api service (so it starts after the database)

  • Added a dependency to the nginx service (so it starts after the api)



For simplicity sake we hardcoded our secrets here. In a production environment you would of course not want to do that! How you can properly manage secrets is a topic for another day (probably tomorrow).






Basic Docker Compose Commands



Here are the most important commands you'll use:





  • docker compose up - Start services


  • docker compose up -d - Start in detached mode


  • docker compose down - Stop and remove containers


  • docker compose ps - List running services


  • docker compose logs - View service logs


  • docker compose build - Build or rebuild services






Next Steps



This is just the beginning of what Docker Compose can do! Tomorrow we will go a bit deeper and learn about some advanced features.



As always, just by looking at the code you won't learn anything. So try converting your existing Docker commands to a compose file. Play around with it and see how it works, and how to break it.

If you have any questions, feel free to reach out by email.



Happy coding! 🐳🎄



Jonas

Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
3 Quellen
Use custom web fonts in Google Sheets charts
2 Quellen
Introducing the new 1Password App for Google Chat
1 Quelle
Context-aware access controls are available for Gemini Enterprise in the Admin console
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Day 11: Docker Compose

Thematisch verwandte Begriffe: Docker, Compose · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...