Search code examples
dockersonarqubedockerhub

Sonarqube doesn't work on Docker


I'm running a docker container; it's sonarqube: When I use this command:

docker run -d --restart=always --name sonarqube -p 9000:9000 -p 9092:9092 sonarqube

The container runs well, but when I use the command to run and to configure the database, this command:

docker run -d --restart=always --name sonarqube -p 9000:9000 -p 9092:9092 -e SONARQUBE_JDBC_USERNAME=my_user_name -e SONARQUBE_JDBC_PASSWORD=my_password -e SONARQUBE_JDBC_URL=jdbc:postgres://host:[email protected]:5432/database?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory sonarqube

I'm getting this error:

"docker run" requires at least 1 argument.
See 'docker run --help'.
Usage:  docker run [OPTIONS] IMAGE [COMMAND] [ARG...] [flags]
Run a command in a new container

What is wrong? or How to fix this little problem?


Solution

  • Use single quotes in your "SONARQUBE_JDBC_URL" environment variable. I just tried to delimit that particular variable so that docker understands it as a complete string with it's starting & ending point. Due to some reason, it was unable to fetch the IMAGE_NAME argument which was required to run the container.

    docker run -d --restart=always --name sonarqube -p 9000:9000 -p 9092:9092 -e SONARQUBE_JDBC_USERNAME=my_user_name -e SONARQUBE_JDBC_PASSWORD=my_password -e SONARQUBE_JDBC_URL='jdbc:postgres://host:[email protected]:5432/database?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory' sonarqube
    

    This worked for me.