6

I would like have spring integration test with the plugin of fabric8, but when I try to run the test I got the next error:

Cannot create docker access object

I have ubuntu and I think that I have well configurated dockers, I haven't had any problems with dockerfiles or dockercompose, so may it will be either a permissions problems or I forgot something.

I past below my fabric8 configuration, this have an image of mysql and the maven-failsafe-plugin to integration test.

<!--maven plugin -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>integration-test</goal>
                        <goal>verify</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <environmentVariables>
                    <it-database.port>${it-database.port}</it-database.port>
                </environmentVariables>
            </configuration>
        </plugin>
        <!--fabric8 plugin -->
        <plugin>
            <groupId>io.fabric8</groupId>
            <artifactId>docker-maven-plugin</artifactId>
            <version>0.18.1</version>
            <configuration>
                <!--<dockerHost>unix:///var/run/docker.sock</dockerHost>-->
                <dockerHost>tcp://0.0.0.0:2375</dockerHost>
            </configuration>
            <executions>
                <execution>
                    <id>prepare-it-database</id>
                    <phase>pre-integration-test</phase>
                    <goals>
                        <goal>start</goal>
                    </goals>
                    <configuration>
                        <images>
                            <image>
                                <name>mysql:5.7</name>
                                <alias>it-database</alias>
                                <run>
                                    <ports>
                                        <port>it-database.port:5432</port>
                                    </ports>
                                    <wait>
                                        <log>database system is ready to accept connections</log>
                                        <time>20000</time>
                                    </wait>
                                </run>
                            </image>
                        </images>
                    </configuration>
                </execution>
                <execution>
                    <id>remove-it-database</id>
                    <phase>post-integration-test</phase>
                    <goals>
                        <goal>stop</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
nole
  • 1,422
  • 4
  • 20
  • 32

4 Answers4

3

A bit late but try to restart Docker. I had the same issue and restarting docker resolved the Problem.

Docker Desktop on Windows 10

Christian
  • 152
  • 1
  • 13
1

Are you sure the docker daemon is listening on port 2375? You may want to try localhost or 127.0.0.1 instead of 0.0.0.0 in the pom.xml.

Could you type

   env | grep DOCKER

It could be a bad environment variable too

James Strachan
  • 9,168
  • 34
  • 31
1

Most likely your desktop configuration is requiring superuser privileges for running docker commands. You should either run your maven build with "sudo" or configure your docker environment in order to not need such privileges.

Rafa S.R.
  • 38
  • 5
0

If you are running docker desktop on windows 10 then we don't need docker host as its required only when using Docker Toolbox (Windows) for the older version of windows and in that we can use docker-machine ip to find out docker host...

Pracheer Pancholi
  • 570
  • 2
  • 7
  • 21