$ git clone https://github.com/edsherwin/docker-sonar-jenkins.git
$ docker build -t jenkins-docker -f Dockerfile.jenkins .
$ docker run -d -p 8080:8080 -p 50000:50000 -v /var/run/docker.sock:/var/run/docker.sock --name jenkins-docker jenkins-docker:latest
Step 3: Check if the Jenkins is running. Also, check if it's mounted to the host machine's Docker socket in the container. This will allow your container to use the host machine's Docker daemon to run containers and build images.
docker ps -a
docker exec -it jenkins-docker bash
docker --version or docker ps
docker run -d --name sonarqube -p 9000:9000 -p 9092:9092 sonarqube
Make sure to change the below config in sonar-runner.properties
#The IP Address of your docker container
sonar.host.url=http://172.17.0.3:9000
sonar.projectKey=ABCProject
sonar.projectName=ABCProject
sonar.projectVersion=1
sonar.login=a4b182a683d8f20f80babc2f14c96e0c22a49fd7