Reputation: 173
I have create a Jenkins container in Docker by using docker run -d -u root --name jenkins -p 8080:8080 -p 50000:50000 -v /root/jenkins_2112:/var/jenkins_home jenkins/jenkins:lts
Then configure the Jenkins.
When create the Docker configure I am getting Connection refuse error
.
I have also create a container from image alpine/socat
using command docker run -d --restart=always -p 127.0.0.1:2376:2375 -v /var/run/docker.sock:/var/run/docker.sock alpine/socat tcp-listen:2375,fork,reuseaddr unix-connect:/var/run/docker.sock
.
The ip of the socat container is 172.17.0.3
.
I am using windows 10.
How can I solved the problem?
Upvotes: 1
Views: 1775
Reputation: 173
This problem is arise for socat is not connected with Jenkins. So the connection is needed. We can solve the problem by 2 steps.
Step 1:
Connect the Jenkins with socat. For the create the Jenkins container with this command:
docker run -d --restart=always -u root --name jenkins-new --link socat:socat -p 8080:8080 -p 50000:50000 -v /root/jenkins_2112:/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock jenkins/jenkins:lts
.
Step 2:
After create the Jenkins container , set other configuration. Then put the Docker Host URI like this : tcp://socat-container-ip.2375
where the command of you socat container is :
docker run -d --restart=always -p 127.0.0.1:2376:2375 -v /var/run/docker.sock:/var/run/docker.sock alpine/socat tcp-listen:2375,fork,reuseaddr unix-connect:/var/run/docker.sock
Upvotes: 1