Docker-maven-plugin: Wait with log does not exit even if successfully matched

Created on 2 Dec 2019  路  6Comments  路  Source: fabric8io/docker-maven-plugin

Description

When I set the tag even if the condition is matched the execution does not exit as I expect.
I set the <log> and the <time>, I run the command mvn integration-test, the image is built and container is started.

WebSphere Liberty Profile starts and application is then deployed:

[INFO] DOCKER> Pattern '(?s).*Application *******-war started in .*' matched for container 7816e2e8242d

but then Maven does not exist with Build Successful as I expect.

This is part of my Maven configuration

<!-- Once fulfilled the condition the startup will be complete -->
<wait>
    <log>(?s).*Application ${docker.run.context.root} started in .*</log>
   <time>600000</time>
</wait>

<!-- Log configuration -->
<log>
    <date>ISO8601</date>
    <color>blue</color>
</log>

Am I missing something?

My system:

  • Maven version: 3.6.1
  • Docker Engine: 19.03.5
  • Docker Desktop: 2.1.0.5
  • Windows 10

Most helpful comment

I also have this problem. I ran docker-maven-plugin (d-m-p) in debug mode and found out that after the log is matched, d-m-p tries to close the tasks, which is somehow locked because the log file is locked by the container (I think this is a Windows problem, because I doesn't have it running on Linux). If anyone can point out a possible solution or give me more information on how to solve it, I will try to contribute a pull request.

LogRequestor tries to close the request HTTPGet request to the log file:

    @Override
    public void finish() {
        if (request != null) {
            request.abort();
            request = null;
        }
    }

Which in turn use Apache's HTTPGet client and request this:
GET npipe://127.0.0.1:1/v1.40/containers/ca923dc3d82a/logs?follow=1&stderr=1&stdout=1&timestamps=1 HTTP/1.1

This request failed because the log file is locked by the system, that's my guess (of course only the docker container locks it).

The maven process will then be halted without any explanation and has to be force stopped.

System info:

d-m-p 0.33.0
Windows 10 Pro 1909
Apache Maven 3.6.1
Java version: 11.0.4, vendor: AdoptOpenJDK

Docker Desktop community version 2.2.0.5
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

All 6 comments

I also have this problem. I ran docker-maven-plugin (d-m-p) in debug mode and found out that after the log is matched, d-m-p tries to close the tasks, which is somehow locked because the log file is locked by the container (I think this is a Windows problem, because I doesn't have it running on Linux). If anyone can point out a possible solution or give me more information on how to solve it, I will try to contribute a pull request.

LogRequestor tries to close the request HTTPGet request to the log file:

    @Override
    public void finish() {
        if (request != null) {
            request.abort();
            request = null;
        }
    }

Which in turn use Apache's HTTPGet client and request this:
GET npipe://127.0.0.1:1/v1.40/containers/ca923dc3d82a/logs?follow=1&stderr=1&stdout=1&timestamps=1 HTTP/1.1

This request failed because the log file is locked by the system, that's my guess (of course only the docker container locks it).

The maven process will then be halted without any explanation and has to be force stopped.

System info:

d-m-p 0.33.0
Windows 10 Pro 1909
Apache Maven 3.6.1
Java version: 11.0.4, vendor: AdoptOpenJDK

Docker Desktop community version 2.2.0.5
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

I also have this problem with docker-maven-plugin 0.34.1 (using Windows)

Related to: #794, #862

So looking at the analysis above https://github.com/fabric8io/docker-maven-plugin/issues/1306#issuecomment-619395581 how do we want to proceed ? (its not easy for me to reproduce this issue).

We could do an request.abort() as a best-effort and continue if this fails. If somebody wants to jump in, and send a PR for fixing this, that would be awesome, as I'm really overloaded and have not time to look into this.

The workaround mentioned in one of the related issues worked for me, so my personal urgency to fix this has decreased x)

<!--
    required for windows, otherwise "wait on log" does not work.
    user must also expose docker daemon without tls in their docker configuration
-->
<dockerHost>tcp://localhost:2375</dockerHost>

So unless it becomes an issue again or I find myself with some free-time and remember the issue I doubt that I can contribute in the near future. I would even try to fix it anyway despite the workaround working, but because the explicit tcp://localhost:2375 works I doubt that its a simple file lock? I understand too little about all the networking going on with docker to have an idea how to fix this.

Hello,
I have overcame the issue creating an heartbeat service to poll, when the application is up an running it exists with successful build, so I don't inspect anymore the logs 馃槉

Tell me if I can close the issue.

Was this page helpful?
0 / 5 - 0 ratings