You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m encountering an issue when using the DockerComposeCmd struct, as it invokes docker-compose (with a hyphen) to manage containers. This is not compatible with Docker Compose V2, which uses the docker compose command (without the hyphen).
The current implementation in the library executes commands like:
let output = Command::new("docker-compose").arg("-f").arg(self.file.clone()).arg("up").arg("-d").output().expect("Failed to execute command");
However, Docker Compose V2 is invoked using docker compose instead of docker-compose, which causes the command to fail when using the V2 plugin version of Docker Compose.
Expected Behavior:
The library should support both the legacy docker-compose command (for Docker Compose V1) and the new docker compose command (for Docker Compose V2). This would allow compatibility with both versions of Docker Compose.
Suggested Solution:
I suggest modifying the command invocation logic in the DockerComposeCmd struct to check for the available version of Docker Compose (V1 vs V2) and call the appropriate command:
Check if Docker Compose V2 is installed: We can attempt to invoke docker compose and fall back to docker-compose if the former isn't available.
I will take it, I just did a PR #5 to handle different compose version. It would be very much appreciated if it is addressed, I would like to use your crate on my project 😄
Description:
I’m encountering an issue when using the DockerComposeCmd struct, as it invokes docker-compose (with a hyphen) to manage containers. This is not compatible with Docker Compose V2, which uses the docker compose command (without the hyphen).
The current implementation in the library executes commands like:
However, Docker Compose V2 is invoked using docker compose instead of docker-compose, which causes the command to fail when using the V2 plugin version of Docker Compose.
Expected Behavior:
The library should support both the legacy docker-compose command (for Docker Compose V1) and the new docker compose command (for Docker Compose V2). This would allow compatibility with both versions of Docker Compose.
Suggested Solution:
I suggest modifying the command invocation logic in the DockerComposeCmd struct to check for the available version of Docker Compose (V1 vs V2) and call the appropriate command:
Check if Docker Compose V2 is installed: We can attempt to invoke docker compose and fall back to docker-compose if the former isn't available.
Example Fix:
Steps to Reproduce:
The text was updated successfully, but these errors were encountered: