Environment variable DOCKER_HOST in windows

I am running Docker 1.12.0 on a machine running Windows 10. I am developing a Java program using Maven 3.3.9 as a dependency manager. I have a maven docker plugin ( https://github.com/fabric8io/docker-maven-plugin ) that gives the following error on a clean install.

[ERROR] Failed to execute target io.fabric8: docker-maven-plugin: 0.15.16: build (docker-build-start) for project-test integration: Running docker-build-start target io.fabric8: docker-maven- plugin: 0.15.16: build failed: no <dockerHost> or <machine> , no environment variable DOCKER_HOST and no / read / writeable '/var/run/docker.sock' β†’ [Help 1]

When I run a clean install with the following configuration option in the POM file:

 <dockerHost>tcp://0.0.0.0:2376</dockerHost> 

The following result is shown.

[ERROR] Failed to fulfill the io.fabric8 target: docker-maven-plugin: 0.15.16: build (docker-build-start) during test project integration: unable to create docker access object: unable to extract API version from https: / /0.0.0.0:2376 : Failed to connect to 0.0.0.0:2376 [/0.0.0.0]: connection rejected: connect β†’ [Help 1]

My question is: is there an IP address that I can use to tell this maven plugin where it can get to the daemon? Normal docker teams work great. The plugin works without any problems with OS X.

+7
source share
5 answers

On Windows 10 with Docker for Windows, the Docker Engine API is available in the following two places:

  • npipe:////./pipe/docker_engine
  • http://localhost:2375

I recommend trying with localhost one.

Details here: https://docs.docker.com/docker-for-windows/faqs/#/how-do-i-connect-to-the-remote-docker-engine-api

+6
source

After almost a day of unsuccessful Google search, I found this solution myself. Trivial, but can still help others.

expose docker daemon

You need to enable the "Expose on ..." daemon in the "Settings" β†’ "General" menu.

+2
source

It seems that the user who is fulfilling the Maven goals does not have access to docker.sock . The error message indicates what options are available to solve the problem.

Neither <dockerHost> nor <dockerHost> nor <machine> , nor the DOCKER_HOST environment variable, nor the read / write '/var/run/docker.sock '

The latter option is the simplest because it requires file permission and does not require creating a docking machine or setting DOCKER_HOST. On Linux, you can change the read / write permission of docker.sock as follows:

 sudo chmod 776 /var/run/docker.sock 

On Windows, go through this article: Microsoft article

+2
source

If someone just wants to skip the execution of fabric8 docker-maven-plugin, which prevents the build from failing

There is no data, there is no DOCKER_HOST environment variable, there is no read / write '/var/run/docker.sock' or '//./pipe/docker_engine' and no external provider such as Docker is configured.

then this can be achieved using -Ddocker.skip=true according to https://dmp.fabric8.io/#global-configuration .

0
source

use docker-machine if you use a toolbar.

  <machine> <name>default</name> <autoCreate>true</autoCreate> <createOptions> <driver>virtualbox</driver> <virtualbox-cpu-count>2</virtualbox-cpu-count> </createOptions> </machine> 
-1
source

All Articles