- --add-host HOST:IP
docker run \ --rm \ -e SONAR_HOST_URL="http://sonarqube:9000" \ -e SONAR_LOGIN="97cd1f21966042b2320539c1b720144d5e2aaced" \ -v "$PWD:/usr/src" \ $(awk '{if(NF>=2){print "--add-host",$2":"$1}}' /etc/hosts) \ sonarsource/sonar-scanner-cli -Dsonar.projectKey=myproject
awk '/^[0-9]/ {print "-add-host",$2":"$1}' /etc/hosts
- -v /etc/hosts:/etc/hosts
docker run \ --rm \ -e SONAR_HOST_URL="http://sonarqube:9000" \ -e SONAR_LOGIN="97cd1f21966042b2320539c1b720144d5e2aaced" \ -v "$PWD:/usr/src" \ -v /etc/hosts:/etc/hosts \ sonarsource/sonar-scanner-cli -Dsonar.projectKey=myproject
- --net host
docker run \ --rm \ -e SONAR_HOST_URL="http://sonarqube:9000" \ -e SONAR_LOGIN="97cd1f21966042b2320539c1b720144d5e2aaced" \ -v "$PWD:/usr/src" \ --net host \ sonarsource/sonar-scanner-cli -Dsonar.projectKey=myproject