0

I am trying to use Fabric8 to build an image for my Java application. However, I am new and this could be a duplicate question.

I have docker installed and the fabric8 library added via maven.

Below is my initial setup for the fabric maven plugin.

<plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>build</goal>
                        </goals>
                        <configuration>
                            <dockerHost>/var/run/docker.sock</dockerHost>
                            <images>
                                <image>
                                    <alias>${project.artifactId}</alias>
                                    <name></name>
                                    <build>
                                        <from>java:8</from>
                                        <maintainer>${project.maintainer}</maintainer>
                                        <dockerFile>${project.basedir}/Dockerfile</dockerFile>
                                        <dockerHost>/var/run/docker.sock</dockerHost>
                                        <ports>
                                            <port>8080</port>
                                            <port>8081</port>
                                        </ports>
                                    </build>
                                </image>
                            </images>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

Below is the error message I am getting.

Unable to parse configuration of mojo io.fabric8:docker-maven-plugin:0.30.0:build for parameter dockerHost: Cannot find 'dockerHost' in class io.fabric8.maven.docker.config.BuildImageConfiguration
user2987773
  • 407
  • 5
  • 18
  • From what I can see maven is unable to parse it. Maybe try adding `dockerHost` via quotes? Does it work when you pass it as a maven property `docker.host`? – Rohan Kumar May 29 '19 at 13:16

1 Answers1

0

Try to remove the dockerHost element from the image build configuration. There is no such option for the build configuration.

dockerHost specifies the connection to the Docker host, i.e the machine where the image is going to be built and eventually run. This option is not actually needed unless the plugin cannot determine it by itself. The discovery sequence is detailed in the Global Configuration section of the docs.

If you build with maven on the machine where the docker daemon runs, you normally don't need this configuration. The plugin will connect to the unix socket /var/run/docker.sock which is the default URL of the docker daemon.

If the requirement is to run the image on a remote host, then you either specify the dockerHost option or the DOCKER_HOST environment variable. On the host, the docker daemon must be configured for remote access.

I hope this helps.

b0gusb
  • 4,283
  • 2
  • 14
  • 33