containerd / nerdctl

contaiNERD CTL - Docker-compatible CLI for containerd, with support for Compose, Rootless, eStargz, OCIcrypt, IPFS, ...
Apache License 2.0
8.22k stars 612 forks source link

nerdctl compose does not pick default compose file #3694

Closed jandubois closed 3 days ago

jandubois commented 3 days ago

The docker compose documentation says:

The default path for a Compose file is compose.yaml (preferred) or compose.yml that is placed in the working directory. Compose also supports docker-compose.yaml and docker-compose.yml for backwards compatibility of earlier versions. If both files exist, Compose prefers the canonical compose.yaml.

This was implemented as part of #305 (although the names were in the wrong order, I think).

But #802 seems to have removed that code again, probably by accident.

$ nerdctl compose up -d
FATA[0000] no configuration file provided: not found

cc: @nino-K

Nino-K commented 3 days ago

Just a quick update, I’m running this (on Rancher Desktop 1.16 and windows 10) and trying the following:

nerdctl compose up -d

While it is mentioned here that there should be compatibility with docker-compose (and the above command works fine with docker), however, it fails with the following error:

FATA[0000] no configuration file provided: not found

Modifying the command to specify the file, however:

nerdctl compose -f .\docker-compose.yaml up -d

It works with no problem.

jandubois commented 3 days ago

This may actually be an issue with Rancher Desktop on Windows; I've tried to repro the issue on macOS, and it seems to be working there:

$ nerdctl compose up -d
WARN[0000] /Users/jan/tmp/composetest/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion
…
jandubois commented 3 days ago

The code to specify default config files at https://github.com/containerd/nerdctl/blob/43b613322cfde3e5460a0738f055578ea1e41dcd/pkg/composer/composer.go#L83

This is likely an issue with the nerdctl-stub handler that converts Windows paths to Linux paths.