Search code examples
node.jsdocker-composesonarqube

Install Node.Js in a Sonarqube instance on the docker-compose


so I'm trying to launch SonarQube on the docker through docker-compose. This is my .yml file:

version: "3"


services:
  sonarqube:
    image: sonarqube
    ports:
     - "9000:9000"
     - "5432:5432"
    links:
      - db:db
    environment:
     - SONARQUBE_JDBC_URL=jdbc:postgresql://db:5432/sonar
     - SONARQUBE_JDBC_USERNAME=postgres
     - SONARQUBE_JDBC_PASSWORD=sonar
    volumes:
     - ..../Work/tools/_SonarQube_home/conf:/opt/sonarqube/conf
#     - sonarqube_data:/opt/sonarqube_new/data
     - ...../Work/tools/_SonarQube_home/data:/opt/sonarqube/data
     - ....../Work/tools/_SonarQube_home/extensions:/opt/sonarqube/extensions
     - ..../Work/tools/_SonarQube_home/bundled-plugins:/opt/sonarqube/lib/bundled-plugins

  db:
    image: postgres
    environment:
     - POSTGRES_USER=postgres
     - POSTGRES_PASSWORD=sonar
     - POSTGRES_DB=sonar
    volumes:
     - .../Work/tools/_PostgreSQL_data:/var/lib/postgresql
     # This needs explicit mapping due to https://github.com/docker-library/postgres/blob/4e48e3228a30763913ece952c611e5e9b95c8759/Dockerfile.template#L52
     - ..../Work/tools/_PostgreSQL_data/data:/var/lib/postgresql/data

Everything boots up and works kind of correctly. Then I'm lauching the analysis of the project and get this error:

INFO: Sensor JavaScript analysis [javascript]
ERROR: Failed to parse Node.js version, got 'Couldn't find the Node.js binary. Ensure you have Node.js installed.

If this would be regular install, I'd just add NodeJs, but it's docker.

How should I fix this? Thanks!


Solution

  • Thank you guys for the answers, especially @leeman24, that is awesome insight how to deal with docker images.

    Although the real solution turned out to be installing NodeJS on MY machine, not the scanner server machine. In other words, server is fine out of the box.