jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.54k stars 4.02k forks source link

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

Closed drfred1981 closed 11 months ago

drfred1981 commented 11 months ago
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 commented 11 months ago

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

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

drfred1981 commented 11 months ago

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 commented 11 months ago

@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 commented 11 months ago

@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 commented 11 months ago

@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 commented 11 months ago

jhipster --skip-checks ignores that error.