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

Starting compose stopped working with exception 'unknown docker command: "compose compose"' #237

Closed
victor-fialkin-deltatre opened this issue Dec 5, 2021 · 8 comments · Fixed by #238
Assignees
Labels
bug under-investigation A investigation is made around the issue
Milestone

Comments

@victor-fialkin-deltatre
Copy link

This code worked before for but stopped working on multiple services with different versions of FluentDocker (probly after docker desktop update)

var builder = new Builder()
                    .UseContainer()
                    .UseCompose()
                    .ServiceName(compose.ServiceName)
                    .FromFile(file)
                    .UseColor()
                    .RemoveOrphans()
                    .KeepOnDispose()
                    .KeepRunning()
                    .WaitForPort(compose.ServiceName, $"{compose.Port}/tcp", 30000 /*30s*/);

if (compose.Profile != null)
                    builder.WithEnvironment($"COMPOSE_PROFILES={compose.Profile}");

var container = builder.Build();
container.Start();

now fails with exception:

Container [path]\docker-compose.yml failed to start: Unknown

Ductus.FluentDocker.Common.FluentDockerException: Could not create composite service with file(s) [path]docker-compose.yml - result: Usage:  docker compose [OPTIONS] COMMAND
Docker Compose
...
unknown docker command: "compose compose"
   at Ductus.FluentDocker.Services.Impl.DockerComposeCompositeService.Start()
   at Ductus.FluentDocker.Services.Impl.DockerComposeCompositeService.Ductus.FluentDocker.Services.ICompositeService.Start()

Starting the same compose file manually works:

docker-compose -f docker-compose.yml --profile [name] up

Versions

  • Docker Desktop 4.3.0 (71786)
  • Ductus.FluentDocker 2.10.7 up to 2.10.42
  • Docker config
{
  "builder": {
    "gc": {
      "defaultKeepStorage": "20GB",
      "enabled": true
    }
  },
  "debug": false,
  "experimental": false,
  "features": {
    "buildkit": false
  },
  "insecure-registries": [],
  "registry-mirrors": []
}
@mariotoffia mariotoffia self-assigned this Dec 7, 2021
@mariotoffia mariotoffia added bug under-investigation A investigation is made around the issue labels Dec 7, 2021
@mariotoffia mariotoffia added this to the 3.0.0-RELEASE milestone Dec 7, 2021
@mariotoffia
Copy link
Owner

mariotoffia commented Dec 7, 2021

Thanks, @victor-fialkin-deltatre for reporting this - I'll have a look. Your "plain" docker does work - It is just the compose one, right?

Cheers,
Mario :)

@twinter-amosfivesix
Copy link

I'm getting the same thing. I only just noticed it today.

My FluentDocker stuff that works directly with containers works. It's just with compose that I get this.

I'm using the latest Docker Desktop, 4.3.0 (71786). I just updated it in the last few days (sorry I'm not exactly sure when).

Running docker-compose from the command line works fine.

We use GitHub Actions for our CI and run this code on a Linux runner. As of right that still works.

I'm using it in an NUnit test. This is the test output.

OneTimeSetUp: Ductus.FluentDocker.Common.FluentDockerException : Could not create composite service with file(s) <snip>...

OneTimeSetUp: Ductus.FluentDocker.Common.FluentDockerException : Could not create composite service with file(s) <snip>\my-compose-file.yml - result: Usage:  docker compose [OPTIONS] COMMAND
Docker Compose
Options:
      --ansi string                Control when to print ANSI control
                                   characters ("never"|"always"|"auto")
                                   (default "auto")
      --compatibility              Run compose in backward compatibility mode
      --env-file string            Specify an alternate environment file.
  -f, --file stringArray           Compose configuration files
      --profile stringArray        Specify a profile to enable
      --project-directory string   Specify an alternate working directory
                                   (default: the path of the Compose file)
  -p, --project-name string        Project name
Commands:
  build       Build or rebuild services
  convert     Converts the compose file to platform's canonical format
  cp          Copy files/folders between a service container and the local filesystem
  create      Creates containers for a service.
  down        Stop and remove containers, networks
  events      Receive real time events from containers.
  exec        Execute a command in a running container.
  images      List images used by the created containers
  kill        Force stop service containers.
  logs        View output from containers
  ls          List running compose projects
  pause       Pause services
  port        Print the public port for a port binding.
  ps          List containers
  pull        Pull service images
  push        Push service images
  restart     Restart containers
  rm          Removes stopped service containers
  run         Run a one-off command on a service.
  start       Start services
  stop        Stop services
  top         Display the running processes
  unpause     Unpause services
  up          Create and start containers
  version     Show the Docker Compose version information
Run 'docker compose COMMAND --help' for more information on a command.
unknown docker command: "compose compose"
  Exception doesn't have a stacktrace

@twinter-amosfivesix
Copy link

I've cloned the FluentDocker repo and tried running some of the tests. I get this unknown docker command: "compose compose" failure with some of the FluentDockerComposeTests tests, like KeepContainersShallWorkForCompositeServices().

@mariotoffia
Copy link
Owner

Thanks, @twinter-patriot - I'll have a look tonight and see if I can reproduce on my side to be able to fix it.

Cheers,
Mario :)

@mariotoffia
Copy link
Owner

@victor-fialkin-deltatre and @twinter-patriot to buy me some time, you can do a docker-compose disable-v2 before running and hence it will switch to docker-compose v1 (to switch back to v2 - docker-compose enable-v2).

Since -H is quite central in this solution, i need to see if I can do some substations.

Cheers,
Mario

@mariotoffia mariotoffia linked a pull request Dec 8, 2021 that will close this issue
@mariotoffia mariotoffia linked a pull request Dec 8, 2021 that will close this issue
@mariotoffia
Copy link
Owner

@victor-fialkin-deltatre and @twinter-patriot I've got a fix so you won't need to switch to v1 (unless you don't use any remote daemon addresses).

It is in the linked PR and I'll release it tonight.

Cheers,
Mario :)

@victor-fialkin-deltatre
Copy link
Author

I can confirm that it works. now.
Thank you very much @mariotoffia for the quick fix! ❤️

@twinter-amosfivesix
Copy link

Thanks for the work on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug under-investigation A investigation is made around the issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants