Tolerate missing env file on runtime commands

Signed-off-by: Max Proske <max@mproske.com>
This commit is contained in:
Max Proske 2026-02-20 21:18:34 -08:00 committed by Guillaume Lours
parent a97738de7d
commit 3a8ff9c7b2
2 changed files with 2 additions and 1 deletions

View file

@ -280,7 +280,7 @@ func (o *ProjectOptions) toProjectName(ctx context.Context, dockerCli command.Cl
return "", err
}
project, _, err := o.ToProject(ctx, dockerCli, backend, nil)
project, _, err := o.ToProject(ctx, dockerCli, backend, nil, cli.WithDiscardEnvFile, cli.WithoutEnvironmentResolution)
if err != nil {
return "", err
}

View file

@ -42,6 +42,7 @@ func TestUnusedMissingEnvFile(t *testing.T) {
c.RunDockerComposeCmd(t, "-f", "./fixtures/env_file/compose.yaml", "ps")
c.RunDockerComposeCmd(t, "-f", "./fixtures/env_file/compose.yaml", "logs")
c.RunDockerComposeCmd(t, "-f", "./fixtures/env_file/compose.yaml", "down")
c.RunDockerComposeCmd(t, "-f", "./fixtures/env_file/compose.yaml", "exec", "serviceA", "echo", "hello")
}
func TestRunEnvFile(t *testing.T) {