Issue
I installed Jenkins on AWS and installed dockerhub on my local machine. When i created a pipeline job in Jenkins and build then I got an error in last build stage.
https://github.com/Raahatx8/docker
I used above repo to create my pipeline, it includes dockefile and jenkinsfile.
This is the error
Solution
Your remote machine i.e. AWS doesn't have connection to the Docker daemon (which is in the local machine) to run the docker commands.
In order to achieve the same i.e. to run the docker commands, you need to do two things:
- Enable Docker Remote API (in your local machine where docker is installed)
- Download docker client (in AWS machine)
Refer to guide: https://gist.github.com/kekru/4e6d49b4290a4eebc7b597c07eaf61f2
Note: Make sure you need to open connection to particular port in local machine, so that AWS machine can connect.
Answered By - Sourav Atta