spotify / dockerfile-maven

MATURE: A set of Maven tools for dealing with Dockerfiles
Apache License 2.0
2.75k stars 493 forks source link

Build is hanging and then completing normally #353

Closed bigtfromaz closed 4 years ago

bigtfromaz commented 4 years ago

Description

I have a Docker build that runs as expected when running this command from a prompt:

docker build -t myimagebname:latest -t myimagebname:$myversion .

However when I run it under Maven with this command: mvn -X dockerfile:build , it completes successfully but only after hanging for a few minutes:

While it's waiting it issues these two debug messages:

[DEBUG] Executing "docker-credential-desktop get"
[DEBUG] Executing "docker-credential-desktop get"

How to reproduce

Issue the build command on a machine using Windows 10, WSL 2 and Docker Desktop for Windows.

<plugin>
    <groupId>com.spotify</groupId>
    <artifactId>dockerfile-maven-plugin</artifactId>
    <version>1.4.13</version>
    <executions>
         <execution>
             <id>default</id>
              <goals>
                    <goal>build</goal>
                    <goal>push</goal>
               </goals>
          </execution>
    </executions>
    <configuration>
           <repository>myimagebname</repository>
                 <tag>latest</tag> 
                 <tag>${project.version}</tag>
                  <buildArgs>
                           <!-- <arg1>${project.build.finalName}.jar</arg1> -->
                   </buildArgs>
    </configuration>
</plugin>

I would expect the MVN build to run about the same speed as the command line build, without the long delay.

I pulled your source and can find no reference to the text in the debug message. So I have no idea who is logging that debug message. I am hoping there's a workaround. The alternative will be to build without your plugin. For the record the build does run normally when the docker build command is issued by the "exec-maven-plugin".

Software:

docker version Client: Docker Engine - Community Version: 19.03.8 API version: 1.40 Go version: go1.12.17 Git commit: afacb8b Built: Wed Mar 11 01:23:10 2020 OS/Arch: windows/amd64 Experimental: false

Server: Docker Engine - Community Engine: Version: 19.03.8 API version: 1.40 (minimum version 1.12) Go version: go1.12.17 Git commit: afacb8b Built: Wed Mar 11 01:29:16 2020 OS/Arch: linux/amd64 Experimental: false containerd: Version: v1.2.13 GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429 runc: Version: 1.0.0-rc10 GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd docker-init: Version: 0.18.0 GitCommit: fec3683

Windows 10 build 2404

The kernel is from Microsoft, the Linux operating system is Ubuntu 18.04.

Maven 3.6.0

Docker Desktop version 2.3.0.3 (45519)

I'll be happy to recreate and capture whatever I can.

fabio-boldrini commented 4 years ago

same problem

Seem as the problem is big file inside the build directory. I never had that problem with docker on hyper-v.

But building from command line (docker build .) is fast.

Maybe this plugin use some "method" to send the build context to docker that badly match with docker on WSL2

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

AdrianFulias commented 3 years ago

I'm having the same issue, is there a way to fix this ? ( hanging for about 17min :( )

maven 3.6.3 dockerfile-maven-plugin 1.4.13 Docker version 20.10.5, build 55c4c88 Docker Desktop version 3.2.2 (61853)

AdrianFulias commented 3 years ago

switched the docker backend from WLS-2 to Hyper-V but the plugin still hangs :(

erilor commented 3 years ago

I also have this issue. It doesn't occur with version 1.4.10, so it seems something happened in v. 1.4.11

santidhammo commented 2 years ago

This problem is still not fixed, I am also experiencing the same issue. Going back to 1.4.10 does not work either, as it appears to be incompatible with WSL2