Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Windows Tipps & SecurityNighthawk M7 Pro im Test: Flexibler, aber teurer 5G-Router(21.09.2026 um 10:30 Uhr)
Sichere ProgrammierungNeue Gmail-Funktion: So sparst du jetzt Zeit bei Einmalcodes(21.09.2026 um 10:00 Uhr)
Sichere ProgrammierungYour GIF exporter is fine — the container is the problem(21.09.2026 um 10:01 Uhr)
Sichere ProgrammierungCSS, Motion, or GSAP? I Choose by Who Owns the Animation(21.09.2026 um 10:12 Uhr)
Windows Tipps & SecurityNighthawk M7 Pro im Test: Flexibler, aber teurer 5G-Router(21.09.2026 um 10:30 Uhr)
Sichere ProgrammierungNeue Gmail-Funktion: So sparst du jetzt Zeit bei Einmalcodes(21.09.2026 um 10:00 Uhr)
Sichere ProgrammierungYour GIF exporter is fine — the container is the problem(21.09.2026 um 10:01 Uhr)
Sichere ProgrammierungCSS, Motion, or GSAP? I Choose by Who Owns the Animation(21.09.2026 um 10:12 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Getting Started with Docker Compose: A Hands-On Guide to Multi-Container Applications

If you’ve been working with Docker, you’ve probably been dealing with single-container applications. However, when your applications become more complex, you may need to run multiple services, such as databases, message queues, or caches. T…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

If you’ve been working with Docker, you’ve probably been dealing with single-container applications. However, when your applications become more complex, you may need to run multiple services, such as databases, message queues, or caches. The question is: Do you install everything in a single container, or do you run multiple containers? And if you run multiple containers, how do you connect them together?



In this blog post, we’ll explore how Docker Compose makes managing multi-container applications easy. We’ll work with a simple to-do list app built with Node.js and MySQL to demonstrate how Docker Compose can manage your containers, network, and persistent data, all in a single YAML file.






Table of Contents




  • Why Use Docker Compose?

  • Prerequisites

  • Lab 1: Setting Up the Application

  • Lab 2: Starting the Application

  • Lab 3: Accessing the Application

  • Tearing Down the Application

  • Conclusion






Why Use Docker Compose?



One of the key best practices for containers is that each container should do one thing and do it well. When your project grows, running everything inside a single container can quickly become a mess. Imagine running a database, an application server, and a message queue all in one container,it’s not scalable, maintainable, or efficient.



Docker Compose solves this problem by allowing you to define multiple containers and their configurations in a single file, called a docker-compose.yml. This file allows you to:





  • Define all services in one place.


  • Automate network setup for your containers.


  • Persist data across container restarts using volumes.


  • Manage environments with environment variables.


  • Rebuild containers when changes are made using a simple command.



Docker Compose is declarative. You define what you need, and when you run docker-compose up, Docker Compose ensures your environment is built correctly.






Prerequisites



Before you begin, make sure you have the following installed:





  • Docker Desktop: Install it from the official Docker website for your operating system.


  • Git: To clone the application repository.






Lab 1: Setting Up the Application



Let’s begin by setting up the sample application.






1. Clone the Sample Application



First, open your terminal and clone the application repository:








2. Explore the Compose File



Inside the todo-list-app directory, you’ll find a file named docker-compose.yml (also called the Compose file). This YAML file defines all the services that make up your application, their configurations, and how they connect.






3. Overview of the Docker Compose File



The docker-compose.yml file includes the following key sections:





  • services: Defines the individual containers (e.g., app, mysql).


  • networks: Specifies how services communicate.


  • volumes: Persists data, especially for databases, even when containers are stopped.


  • environment variables: Provides configuration data to containers.








Lab 2: Starting the Application



Now, let’s start the application with Docker Compose.






1. Run the Application Using Docker Compose



Run the following command to start the application in detached mode (-d) and build the services:










What happened?




  • Docker pulled the Node.js and MySQL images from Docker Hub.

  • A new network was created for the application to allow communication between the containers.

  • A volume was created to persist MySQL data.

  • Two containers, todo-list-app-app-1 (Node.js app) and todo-list-app-mysql-1 (MySQL), were started.








Lab 3: Accessing the Application



Once everything is up and running, you can access your to-do list app in your browser.






1. Access the Frontend



In your browser, visit:



or on docker desktop, click










2. View the Containers in Docker Desktop



You can also use Docker Desktop to monitor your containers and their configurations. Open Docker Desktop and navigate to the Containers tab to see the todo-list-app-app-1 and todo-list-app-mysql-1 containers.








Tearing Down the Application



When you're done with the application, it’s easy to tear everything down using Docker Compose.






1. Stop the Containers



To stop all running containers and remove them, run:





Expected Output:








2. Remove Volumes (Optional)



By default, volumes are not removed when tearing down the application to allow you to retain your data. If you want to remove the volumes as well, run:





Expected Output:








Conclusion



In this hands-on guide, you learned how to use Docker Compose to define, build, and run a multi-container application. We explored how to:





  • Set up and configure services using docker-compose.yml.


  • Start the app and view it in your browser.


  • Easily tear down the app when done.



Docker Compose makes it easy to work with multiple containers, saving time and effort when managing complex applications. This workflow is essential for modern development, and now you’re equipped to run your own multi-container Docker applications.

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Getting Started with Docker Compose: A Hands-On Guide to Multi-Container Applications

Thematisch verwandte Begriffe: Getting, Started, with, Docker · 6 Treffer

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-94030 | A security vulnerability has been detected in SerenityOS up to 3d83e4509…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick