Follow these steps to modify the docker.conf file. These configurations are important to allow Jenkins to communicate with the Docker host:
- Log in to your Docker server, make sure you have sudo privileges.
- Execute the following command to edit the docker.conf file:
sudo nano /etc/init/docker.conf
- Inside the docker.conf file, go to the line containing DOCKER_OPTS=.
You will find the DOCKER_OPTS= variable at two places inside the docker.conf file. First, in the pre-start script section, and next in the post-start script section. Use the DOCKER_OPTS= variable under the pre-start script section.
- Set the value of DOCKER_OPTS to the following:
DOCKER_OPTS='-H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock' ...