Introduction
Docker Compose is a tool for defining and managing multi-container Docker applications. It allows developers to configure all application services (including their dependencies, networks, and storage settings) within a single declarative YAML file, typically named compose.yaml.
By consolidating configuration and orchestration into one file, Docker Compose simplifies the deployment process. Rather than launching each container manually with individual commands, compose enables you to bring up the entire application stack with a single command, ensuring consistency and ease of management across development and production environments.
This is a series of articles. You will likely follow them in this order.
- Docker Compose Overview - You are here!
- Create the Compose Runtime Application
- Agent Overview
- Add a Docker Compose as an Edge App Type
- Troubleshooting Docker Compose
Key Features
Some of the key features of ZEDEDA’s Docker Compose support:
- Integrated Observability: Docker Compose is supported as an edge application type, with logs and metrics, and it is accessible from the ZEDEDA GUI.
- Dedicated Docker Agent: A new ZEDEDA agent has been introduced to manage Docker Compose instances within the runtime environment.
- Secure Configuration Delivery: Encrypted patch envelopes securely transmit both Docker Compose files and the container registry credentials.
- Protected Secret Management: Ensures encrypted transfer of container secrets and environment variables using patch envelopes. Secrets intended for Docker Compose consumption are transferred using the existing cloud-init mechanism.
- Lifecycle Management: Supports native lifecycle actions applied to Docker Compose applications. For example, activate, deactivate, restart and purge.
- Separation of Hardware and App Stack: The Compose Runtime app ensures isolation between the edge-node platform and the application stack, since containers are running in a virtualized environment and are not running on bare metal.
Benefits of Using Docker Compose
As a declarative specification for defining and managing multi-container Docker applications, Docker Compose simplifies the process of managing multi-container applications. You don't need to remember and execute long docker run commands for each container. Other benefits of Docker Compose include:
- Repeatability: The compose.yaml file acts as a blueprint, ensuring that your application setup is consistent across different environments. This is ideal for development, testing, and production.
- Centralized Management: ZEDEDA Cloud can leverage the compose file to manage the entire application stack on the edge device, providing better control and visibility.
- Simplified Deployment: You can define complex multi-container applications in a compose.yaml file and deploy them to edge devices through the ZEDEDA cloud platform.
- Easier Updates and Rollbacks: Updating or rolling back an entire application composed of multiple containers can be managed more efficiently through the Compose definition.
- Reduced Complexity: Admins won't need to manually orchestrate the deployment and networking of individual containers on each edge device, saving time and effort.
- Efficiency: Starting and stopping your entire application becomes a one-command operation.
Docker Compose brings the ease and efficiency of container orchestration, which is commonly used in cloud environments, to the management of edge applications.
Docker Compose Topology
The topology shows an edge node with EVE-OS running on the underlying hardware. ZEDEDA’s support for Docker Compose relies on Compose Runtime, which is the implementation for managing containerized applications. The runtime environment is where containers are deployed, and within the runtime, edge apps with one or more containers are managed.
The ZEDEDA compose agent (also referred to as "zrun-agent" or “Z-Agent”) plays a crucial role in the container orchestration by handling Docker Compose operations. The compose agent enables the deployment and management of complex applications with multiple interconnected containers.
Multiple applications can co-exist within the Compose Runtime. The ZEDEDA platform can host and orchestrate distinct containerized workloads. For example, you could have a container with one app, and a separate container running two apps.
In terms of networking, the edge node establishes network connectivity through two interfaces, allowing for segregated network communication for management and application traffic:
-
- eth1 is connected to the public switched network instance. The containers launched via compose use eth1 for their network communication that needs to go out to the public network.
- eth2 is connected to the air-gapped local network instance. The compose agent uses eth2 for any management traffic.
YAML vs TAR files
When adding a Docker Compose as an Edge App type in the ZEDEDA GUI, there is a mandatory choice where you must specify whether you want to import a YAML file or a TAR file. This refers to how you will be providing the Docker Compose configuration to the ZEDEDA Cloud.
-
YAML (.yaml or .yml): This is the plain text file used to define a Docker Compose application. This file, which is written in YAML format, describes the services, networks, volumes, and other configurations for your multi-container application. The Compose Runtime will translate this file to understand how to deploy and manage your containers, but this functionality must be loaded into ZEDEDA Cloud via the Marketplace.
- TAR (.tar): A TAR file is an archive format that can bundle multiple files together. You should choose this option if you are deploying multiple edge apps, and if you have packaged your compose.yaml file (and other related files) into a single TAR archive. This approach can be useful for organizing your app definition or if your workflow involves distributing the configuration as a single file. ZEDEDA will unpack this TAR file to access the compose.yaml file within.
You should choose the YAML file if you have a standalone compose.yaml file and a less complex configuration scenarios. However, you should choose the TAR image if you have a more complex scenario involving multiple edge apps, which you have already bundled into a .tar archive.
YAML special character limitations
YAML has several limitations regarding the use of special characters when creating your YAML file::
Limitation | Description |
Reserved characters |
Characters like:
message1: 'This string contains < and >.' message2: "This string also has < and >." |
Quotes requirement | Values containing special characters usually need to be enclosed in single or double quotes. For example: name: 'John O'Connor' or description: "Contains # and : symbols" |
Escaping quotes | To include quotes within quoted strings, either use the alternate quote style or escape them:<br>- message: "He said, 'Hello'" <br>- message: 'She said, "Goodbye"'<br>- message: "Quote \"within\" quotes" |
Leading/trailing spaces | YAML is whitespace-sensitive, so be careful with spaces at the beginning or end of unquoted values. |
Indentation | Must use consistent indentation (typically 2 spaces) and never tabs. |
Line breaks | Multiline strings require special indicators like | (preserves line breaks) or > (folds line breaks). |
Next steps
This is a series of articles. You will likely follow them in this order.
- Docker Compose Overview - You are here!
- Create the Compose Runtime Application
- Agent Overview
- Add a Docker Compose as an Edge App Type
- Troubleshooting Docker Compose
After you’ve completed the series, you might be interested in the following articles.