Reputation: 159
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?
Upvotes: 2
Views: 5899
Reputation: 165
The sonarqube docker image latest version did not work for me either, However below image worked for me. If you using docker for learning purpose you can follow below steps. Please note, By default, the image will use an embedded H2 database that is not suited for production.
Run below command to pull the docker image:
docker pull sonarqube:lts-community
Run below command to create the docker container for sonarqube:
-h, --hostname string Container host name -d, --detach Run container in background and print container ID
docker run --name sanarqube -h sonarqube -p 8084:9000 -d sonarqube
search sonarqube UI in your favourite browser
http://YOUR-IP:8084/
Then to stop the conatiner
docker stop sonarqube
Then to start the conatiner
docker start sonarqube
Hope this help!
Upvotes: 2
Reputation: 14903
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.
Upvotes: 4