Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new compose Kind #2308

Open
vista- opened this issue Nov 21, 2024 · 0 comments
Open

Add new compose Kind #2308

vista- opened this issue Nov 21, 2024 · 0 comments

Comments

@vista-
Copy link
Contributor

vista- commented Nov 21, 2024

Users should be able to use Docker Compose projects in their Containerlab labs.

Motivation

At the moment, it requires some finesse and ext-container usage to be able to inject a project created via Docker Compose to a given container lab. Many of the more complex network applications require spinning up multiple containers for their dependencies, such as akvorado, and are made available as a Docker compose project.

To ease the creation of labs that include such applications, a new type of Kind, compose, could be introduced.

New compose kind

The compose kind should be very easy to use, like docker compose is. Specify a Docker Compose project (a YAML file), and you should have your Compose project running and connected into the lab's management network.

topology:
  nodes:
    composed_app:
      kind: compose
      project: app.yaml

Implementation

The Docker API used in the docker runtime implementation already includes Docker Compose functionality. The first, initial implementation of this feature should be able to load a given YAML file containing a Docker Compose project. The project's network, subnet and gateway config should be adjusted to match the lab's own, before passing it to the API's equivalent of docker compose up -d.

For tearing down the lab, one can just use the docker compose down API equivalent -- since Docker's Compose functionality does not require storing state, it can just re-use the specified compose project file.

The tricky parts are: data plane links to the composed application's containers, and of course, overriding regular single-container behaviour that default nodes exhibit.

The latter can be done by looking at ext-container's code and doing a similar approach (e.g. override GetContainers to return multiple containers associated with the Compose Project).

Limitations

There are some projects where a Docker Compose project is made out of multiple files, or to use overrides/envvars for templating. Data-plane links is also a hard problem to solve. The initial implementation should not be required to support these.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant