I'm runner Docker for OSX, and having trouble getting the Docker remote API to work.
My situation is this:
- Docker daemon running natively on OSX (https://www.docker.com/products/docker#/mac, so not the boot2docker variant)
- Jenkins running as docker image
No I want to use the Jenkins docker-build-step plugin to build a docker image, but I want it to use the docker daemon on the host machine, so in Jenkins settings, DOCKER_URL should be something like :2375. (Reason for this is I don't want to install docker on the jenkins container if I already have it on my host machine).
Is there a way to to this or is de Docker for Mac currently not supporting this? I tried fiddling with export DOCKER_OPTS or DOCKER_HOST options but still get a Connection refused on calling http://localhost:2375/images/json for example.
Basicly the question is more about enabling the Docker for OSX remote api, with use case calling it from a Jenkins docker container.
You could consider using socat. It solved my problem, which seem to be similar.
This allows you to access your macOS host Docker API from a Docker container using:
tcp://[host IP address]:2375
On macOS socat can be installed like this:
See here for a long discussion on this topic: Plugin: Docker fails to connect via unix:// on Mac OS X