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

firefly fails check for docker compose v2 due to wrong flag -v #231

Closed
ggessner opened this issue Jan 4, 2023 · 2 comments
Closed

firefly fails check for docker compose v2 due to wrong flag -v #231

ggessner opened this issue Jan 4, 2023 · 2 comments
Labels
good first issue Good for newcomers

Comments

@ggessner
Copy link
Contributor

ggessner commented Jan 4, 2023

Issue

This is a simple issue. When creating a new stack and trying to start the stack, an error is thrown:

Error: an error occurred while running docker-compose. Is docker-compose installed on your computer?
Usage:
  ff start <stack_name> [flags]
...

I can confirm that docker and compose as part of the cli is installed correctly. Below the output for the versions used by my setup

docker version

docker compose version

# docker version ######################################################

Client: Docker Engine - Community
 Version:           20.10.21
 API version:       1.41
 Go version:        go1.18.7
 Git commit:        baeda1f
 Built:             Tue Oct 25 18:01:19 2022
 OS/Arch:           linux/arm64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.21
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.18.7
  Git commit:       3056208
  Built:            Tue Oct 25 17:59:41 2022
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.6.10
  GitCommit:        770bd0108c32f3fb5c73ae1264f7e503fe7b2661
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

# docker compose version ###############################################
Docker compose version v2.12.2

# firefly version #######################################################
{
  "Version": "1.1.2",
  "Commit": "8b462fff760e1c7cc1d11c3ddb34638c094b0f2e",
  "Date": "2022-11-17T21:16:50Z",
  "License": "Apache-2.0"
}

I tried to alleviate the problem by providing aliasing or a redirect using a script file /bin/docker-compose. Both tricks work but do not solve the error.

Cause

A little inspection of the source code points to the version check failing since docker-compose -v translated to docker compose -v does not exists as valid command; the flag -v has been replaced by version.

The line throwing the error is CheckDockerConfig.

Non-invasive Workaround

A fix that does not include changing any source code is done by creating a file /bin/docker-compose that captures and delegates the correct call:

#file content of /bin/docker-compose
if [[ $1 == '-v' ]]; then
        docker compose version
else
        docker compose $@
fi
@ggessner
Copy link
Contributor Author

ggessner commented Jan 6, 2023

Hi Andrew,

following up on this issue, I decided to provide a solution that keeps compatibility for people who still use the old docker-compose v1 (instead of the easy fix to simply replace docker-compose with docker compose):

PR: first draft for supporting docker-compose v2 #232

@ggessner
Copy link
Contributor Author

ggessner commented Jan 10, 2023

The PR resolving this issue has been merged.
Closing the Issue.

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

No branches or pull requests

2 participants