Hi guys,
I am trying to use docker-swarm-plugin for Jenkins: GitHub - jenkinsci/docker-swarm-plugin: Jenkins plugin which allows to add a Docker Swarm as a cloud agent provider.
The first thing I have to configure is the docker swarm API URL, in th plugin configuration called “Docker Host URI”. I tried to use unix:///var/run/docker.sock
as I did before with the jenkins docker-plugin but I get an error (yes, I mounted the socket to the container and yes, I set permissions to 777 in the container to be sure the user can access it):
java.lang.NullPointerException
at org.jenkinsci.plugins.docker.swarm.docker.api.request.ApiRequest.(ApiRequest.java:53)
at org.jenkinsci.plugins.docker.swarm.docker.api.ping.PingRequest.(PingRequest.java:10)
…
The plugin documentation uses a https… URL and says that
Docker swarm api url: The URL to the API of the Swarm you want to target. The API is not exposed by default, so you will likely need to take manual actions to expose it. Depending on your OS the method may vary but you basically need to add the
-H tcp://0.0.0.0:<port>
option at Docker startup. Failing to do so will result in a “Failed to _ping” error.
So I followed this article (https://success.docker.com/article/how-do-i-enable-the-remote-api-for-dockerd) and added a /etc/systemd/system/docker.service.d/startup_options.conf
file to expose the api on port 2376. Then I tried to configure https://[my-swarm-manager-ip]:2376 as Docker Host URI but I got the same error as shown above. I also tried
- tcp://[my-swarm-manager-ip]:2376
- http://[my-swarm-manager-ip]:2376
- tcp://127.0.0.1:2376
- http://127.0.0.1:2376
- https://127.0.0.1:2376
But none of this works, always same error as shown above.
When I do docker info
I get the following warning:
WARNING: API is accessible on http://0.0.0.0:2376 without encryption.
Access to the remote API is equivalent to root access on the host. Refer
to the ‘Docker daemon attack surface’ section in the documentation for
more information: Docker security | Docker Docs
But as I mentioned, I tried those URLs and it did not work. Can anyone give me some advice?
Kind regards
Timo