Understanding Docker-Compose: Structure and basic usage
Overview
When deploying Docker containers on Barbara Edge Nodes, direct command-line access is not available for building and running images. So how can we start, configure, or stop applications in this environment?
Barbara handles the deployment and management of applications using the docker-compose.yaml file, a vital tool for orchestrating multi-container Docker applications. This tutorial will explain what it is, its purpose, key components, and provide a step-by-step hands-on practice.
Videotutorial
Watch this tutorial on Understanding Docker Compose - Structure and Basic Usage.
What is docker-compose.yaml?
docker-compose.yaml is a configuration file used by Docker Compose, a tool that helps define and manage multi-container Docker applications. Instead of running multiple docker run commands manually, you can define all the services, networks, and volumes in a single YAML file and deploy them with a single command.
Why Use docker-compose.yaml?
- Simplifies multi-container application management: Define all services in one place.
- Ensures reproducibility: Share the file to ensure consistent deployments.
- Automates container dependencies: Define service order and networking.
- Provides easy scaling: Modify service counts with minimal effort.
Structure of docker-compose.yaml
A typical docker-compose.yaml file consists of the following sections:
Version
Specifies the Compose file format version.
version: '3.8'
Services
Defines the individual containers that make up the application.
services:
web:
image: nginx:latest
ports:
- "80:80"
Networks
Allows communication between services.
networks:
my_network:
Volumes
Defines persistent storage for containers.
volumes:
my_volume:
Hands-on Practice: Running a Simple docker-compose.yaml
Let's create a basic setup using the Filebrowser image, which provides a web-based file manager.
Step 1: Create a docker-compose.yaml File
Create a new directory and inside it, create a file named docker-compose.yaml with the following content:
version: '3.8'
services:
filebrowser:
image: filebrowser/filebrowser:latest
ports:
- "8080:80"
volumes:
- ./data:/srv
networks:
- app_network
networks:
app_network:
Step 2: Start the Service
Run the following command in the same directory:
docker-compose up -d
This will start the Filebrowser container in detached mode.
Step 3: Verify the Running Container
Check if the container is running with:
docker ps
Step 4: Access the Filebrowser Interface
Open a browser and go to http://localhost:8080. You should see the Filebrowser web interface where you can manage files.
Step 5: Stop and Remove the Container
To stop and clean up the container, use:
docker-compose down
Hands-on Practice 2: Deploying the Filebrowser Image to an Edge Node
Let's deploy the Filebrowser application to an edge node using the docker-compose.yaml file.
Step 1: ZIP the docker-compose.yaml File
Compress the folder you created in the previous steps, which contains the docker-compose.yaml file.
Step 2: Create a New Application in the Barbara Panel Library
- Go to your Barbara Panel's Library.
- Add a new application named
filebrowser. - Once created, add a new version to the application.
- Upload the ZIP file you created in the last step.

Uploading new version
Step 3: Deploy the Application to an Edge Node
- Select one of your edge nodes.
- Click the
Add cardbutton. - Choose
Add a new applicationand select thefilebrowserapplication you just created.

Filebrowser card
Step 4: Access the Filebrowser Interface
Open a browser and navigate to http://[IP_OF_YOUR_NODE]:8080. You should see the Filebrowser web interface, allowing you to manage files. This instance of the Filebrowser application is now running on your remote edge node.

Filebrowser app
Step 5: Stop and Remove the Application
Using the application card in the Barbara Panel, you can stop the application or uninstall it entirely.
Summary
The docker-compose.yaml file simplifies the deployment and management of multi-container applications, making it an essential tool for deploying applications on Barbara’s edge nodes. Understanding its structure and using it in practice will help you efficiently manage your Docker-based workloads.