Docker Compose v2
Automated Docker Compose deployments¶
Docker Compose is a powerful tool designed to simplify the management of multi-container Docker applications. By defining all the services required for your application in a single YAML file, Docker Compose enables you to streamline the process of building, running, and scaling containerized applications.
Instead of manually managing individual containers, networks, and volumes, Docker Compose allows you to declaratively configure your application’s environment. This approach not only saves time but also ensures consistency and portability across development, testing, and production environments.
Docker Compose and qbee-agent¶
Running Docker Compose projects through qbee can be achieved either by deploying all relevant resources through File Distribution, or by using the tailored Docker Compose V2 integration in the qbee-agent. The latter provides a more intuitive configuration interface and closer control of your docker-compose environment. NB: It is important to note that this integration currently only supports the newer Docker Compose v2 implementation, and not the Python based docker-compose v1 implementation. However, docker-compose v1 deployments can still be achieved using File Distribution.
Configuring Docker Compose¶
The following configuration options are available:
Required:
- Project name - a valid Docker Compose project name (required)
- Compose file - a Docker Compose yaml file (required). This file can be templated in case you need Secrets and/or parameters
Optional:
- Clean - clean any Docker Compose projects that have been deployed by qbee, but which is not part of the current configuration
- Pre-condition - a script/command that needs to return zero for the Docker Compose configuration to be evaluated
- Template parameters - any template parameters if the compose file is in template format
- Skip restart - skip restart of project if any of the containers have exited
- Build Context - a build context needed for the Docker Compose project (NB: not recommended for production)
Note on Build Context¶
It is in general recommended to use immutable tags for production docker deployments. This provides:
- Predictability and consistency
- Version control
- Consistent environments
In practical terms this means that for production use it is not recommended use either the latest
tag or to build any docker image on the target devices itself. The Docker Compose configuration option for qbee still supports build contexts in case it is needed for development.