I want to use jenkins to run our testcases but our application has set of docker container which will get initiated when i run npm run deploy:
problem: rabbitmq port is refused:localhost port 15672: Connection refused from inside the container while it is reachable outside the container.
following are the current setup details:
docker image from jenkins/jenkins:lts
using dockerfile that will build the dependencies for jenkins that also has curl docker(docker inside docker), docker build will build image tagged by
docker run --name myjenkins -u root -d -p 8080:8080 -p 50000:50000 -v jenkins-data:/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock testSample
root@373d88dc52e5:/var/jenkins_home/workspace/pipelineDemo@script# curl http://localhost:15672 curl: (7) Failed to connect to localhost port 15672: Connection refused
but when I use
--net=host
in docker run command as follows:docker run --name myjenkins -u root -d -p 8080:8080 -p 50000:50000 -v jenkins-data:/var/jenkins_home /var/run/docker.sock:/var/run/docker.sock --net =host testSample
Rabbitmq is responding and I can run all my test cases
but my project does not want me to use --net=host
for security issues
is there any other way such that i can reach rabbitmq and run testcases?