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

Can't find docker-compose version, when docker-compose is instaleld #24191

Closed
drfred1981 opened this issue Nov 12, 2023 · 6 comments · Fixed by #24201
Closed

Can't find docker-compose version, when docker-compose is instaleld #24191

drfred1981 opened this issue Nov 12, 2023 · 6 comments · Fixed by #24201

Comments

@drfred1981
Copy link

Overview of the issue

When running jhispter docker-compose command, version 8.0.0rc1 and above.

getting this error :
INFO! Docker is installed

ERROR! Docker Compose 1.6.0 or later is not installed on your computer.

     Read https://docs.docker.com/compose/install/

ERROR! An error occured while running jhipster:docker-compose#checkDockerCompose

ERROR! ERROR! Cannot read properties of undefined (reading 'replace')

TypeError: Cannot read properties of undefined (reading 'replace')

at DockerComposeGenerator.checkDockerCompose (file:///usr/lib/node_modules/generator-jhipster/dist/generators/docker-compose/generator.mjs:74:60)

at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

at async DockerComposeGenerator.executeTask (file:///usr/lib/node_modules/generator-jhipster/node_modules/yeoman-generator/dist/actions/lifecycle.js:244:13)

at async runLoop.add.once (file:///usr/lib/node_modules/generator-jhipster/node_modules/yeoman-environment/dist/environment-base.js:381:17)
Motivation for or Use Case

I've have installed docker-compose, with apt and also wia command line, same bug appeared

Reproduce the error

run :
jhispter docker-compose on a jhipster project

Related issues
Suggest a Fix

Edit :

generators/docker-compose/generator.mjs

At line 69
replace :
const { stdout, exitCode } = await this.spawnCommand('docker compose version', { reject: false, stdio: 'pipe' });
by
const { stdout, exitCode } = await this.spawnCommand('docker-compose version', { reject: false, stdio: 'pipe' });

JHipster Version(s)
JHipster configuration

8.0.0rc1 and above (ive not tried on v 7 and above

Entity configuration(s) entityName.json files generated in the .jhipster directory

Is not impacted by entities

Browsers and Operating System

ubuntu

@mshima
Copy link
Member

mshima commented Nov 12, 2023

The check seems to be outdated.
I don't know what we should test.

We currently require Compose file v3.
Looks like we need:

  • docker compose version >= 1.10
  • docker engine >= 1.13.0 (maybe greater).

@drfred1981
Copy link
Author

drfred1981 commented Nov 12, 2023

Hello everybody
Sorry if i'm not clear

please see the code in the main branche, as i point at the picture, the character "-" is missing in the spawnCommand,
That's the fix for this bug

checkComposeInJhipster

Best regards

@mshima
Copy link
Member

mshima commented Nov 12, 2023

@drfred1981 IFAIK docker-compose is now an alias for docker compose.

See:

% docker-compose --help

Usage:  docker compose [OPTIONS] COMMAND

Define and run multi-container applications with Docker.

I don't know how this works or if docker-compose can be used standalone.

@drfred1981
Copy link
Author

drfred1981 commented Nov 12, 2023

@mshima
Hello thanks for your answer
Docker compose is not a command for docker in my version,

if it "docker compose" must be used as it, i suggest, to add a complementary check based on the required version of docker

here is my client docker version installer on Ubuntu 22.04.3 LTS

try to help
best regards

Client: Version: 24.0.5 API version: 1.43 Go version: go1.20.3 Git commit: 24.0.5-0ubuntu1~22.04.1 Built: Mon Aug 21 19:50:14 2023 OS/Arch: linux/amd64 Context: default Server: Engine: Version: 24.0.5 API version: 1.43 (minimum version 1.12) Go version: go1.20.3 Git commit: 24.0.5-0ubuntu1~22.04.1 Built: Mon Aug 21 19:50:14 2023 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.7.2 GitCommit: runc: Version: 1.1.7-0ubuntu1~22.04.1 GitCommit: docker-init: Version: 0.19.0 GitCommit:

@mshima
Copy link
Member

mshima commented Nov 12, 2023

@drfred1981 docker compose is the official command for docker-compose v2. Check upstream issue and a possible workaround.

Since we use docker compose everywhere, we should require docker compose version to return the version.

@mshima
Copy link
Member

mshima commented Nov 13, 2023

jhipster --skip-checks ignores that error.

@deepu105 deepu105 added this to the 8.1.0 milestone Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants