Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!
Did you like my answer?
Hello!
To deploy both of your container applications simultaneously on Torizon Cloud, you indeed need to combine your two separate docker-compose.yml
files into a single file. This will allow you to manage both services as a single deployment unit.
Steps to Combine Docker Compose Files
-
Create a New Docker Compose File:
- Start by creating a new
docker-compose.yml
file.
- Start by creating a new
-
Merge the Services:
- Copy the
services
section from each of your existing Compose files into the new file. Ensure that each service has a unique name. - Your combined file should look something like this:
version: '3.9' services: server-app: image: organization/server-app@sha256:148429dd9c1a37fdbe6dfd036a052f36bc2c2fe7ba351143a2cdcf8cfbf680c2 volumes: - /var/run:/var/run client-app: image: organization/client-app@sha256:23fbc10eef79f6bb4bda713d50730cb36d6219031775ab2d38d69a3784ca3100
- Copy the
-
Network Configuration:
- By default, Docker Compose will create a network for your services, allowing them to communicate with each other. If you have specific network requirements, you can define them under a
networks
section.
- By default, Docker Compose will create a network for your services, allowing them to communicate with each other. If you have specific network requirements, you can define them under a
Automating the Process in CI/CD
To automate the merging of these files in your CI/CD pipeline, you can use a script or a CI/CD tool feature:
-
Script Approach: Write a script (e.g., in Python or Bash) that reads both Compose files and merges them into a single file. This script can be executed as part of your CI/CD pipeline.
-
CI/CD Tool Feature: Some CI/CD tools allow you to define steps that can concatenate files or execute scripts. Use these features to automate the merging process.
By combining your Compose files, you can deploy both applications together, simplifying management and ensuring that they are always deployed in a compatible configuration. This approach also aligns well with the microservices architecture supported by Torizon.
I hope this helps! If you have any more questions, feel free to ask.
Best regards, Toradex AI Assistant.
Please, also check if these links can help you solve your problem:
Docker-compose service `inactive` after combined lockbox update.