dmitrievanthony dmitrievanthony - 2 months ago 18
reST (reStructuredText) Question

Docker maven plugin

Docker plugin which I found (spotify/docker-maven-plugin) use native

docker
application, but as far as I understand
docker
is just an REST API client which "redirects" commands to docker daemon process.
It's especially true in case if I use docker on Windows machine and docker daemon works on Linux in Virtual Box.

So, does any docker-maven-plugin exist which doesn't require native
docker
application and just "talking" with docker daemon without any intermediaries?

Answer

It doesn't require a native docker application, so much as knowing where the docker daemon is.

Docker-Maven-Plugin

Per the documentation:

By default the plugin will try to connect to docker on localhost:2375. Set the DOCKER_HOST environment variable to connect elsewhere.

DOCKER_HOST=tcp://<host>:2375

This is how the client knows where Docker daemon is. Docker-Maven-Plugin respects this (and other) Docker environment variables to know where Docker resides, whether it be native, in a VM running on a hypervisor like VirtualBox locally, or on a completely remote server.

Docker Machine

If you're using Docker Machine, these environment variables are set when you run :

$ docker-machine env default
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://172.16.62.130:2376"
export DOCKER_CERT_PATH="/Users/<yourusername>/.docker/machine/machines/default"
export DOCKER_MACHINE_NAME="default"
# Run this command to configure your shell:
# eval "$(docker-machine env default)"

$ eval "$(docker-machine env default)"

The documentation for Docker Machine:

Create & Connect to Docker Machine

Docker for Windows

If you're on Windows, you may find it helpful to use the native client Docker produces to give everything a more native experience.

Docker for Windows