fabric8io / docker-maven-plugin

Maven plugin for running and creating Docker images
https://dmp.fabric8.io
Apache License 2.0
1.87k stars 640 forks source link

container not stoping properly #406

Open vimalprakashts opened 8 years ago

vimalprakashts commented 8 years ago

hi,

I am using mongodb image in my project. build and test run all succeeded, but container not stoping and removing in jenkins. in my local machine this problem occurs ver rarely , I thought the version of this plugin, so updated to 0.4.1 , still I am facing this issue. any suggestion for me?

here is the log

[INFO] --- docker-maven-plugin:0.14.1:stop (stop) @ myproject --- 21:33:38.199 MongoDB> 2016-03-09T20:33:38.197+0000 I CONTROL [signalProcessingThread] got signal 15 (Terminated), will terminate after current cmd ends 21:33:38.199 MongoDB> 2016-03-09T20:33:38.197+0000 I FTDC [signalProcessingThread] Shutting down full-time diagnostic data capture 21:33:38.199 MongoDB> 2016-03-09T20:33:38.198+0000 I CONTROL [signalProcessingThread] now exiting 21:33:38.199 MongoDB> 2016-03-09T20:33:38.198+0000 I NETWORK [signalProcessingThread] shutdown: going to close listening sockets... 21:33:38.199 MongoDB> 2016-03-09T20:33:38.198+0000 I NETWORK [signalProcessingThread] closing listening socket: 5 21:33:38.199 MongoDB> 2016-03-09T20:33:38.198+0000 I NETWORK [signalProcessingThread] closing listening socket: 6 21:33:38.199 MongoDB> 2016-03-09T20:33:38.198+0000 I NETWORK [signalProcessingThread] removing socket file: /tmp/mongodb-27017.sock 21:33:38.199 MongoDB> 2016-03-09T20:33:38.198+0000 I NETWORK [signalProcessingThread] shutdown: going to flush diaglog... 21:33:38.199 MongoDB> 2016-03-09T20:33:38.199+0000 I NETWORK [signalProcessingThread] shutdown: going to close sockets...

jenkins keeps says loading gif after this line.

steveblackmon commented 8 years ago

I'm seeing a similar behavior with elasticsearch, running in jenkins on centos

[JENKINS] Recording test results 20:10:11.402 elasticsearch> [2016-03-09 20:10:11,402][INFO ][node ] [Epoch] stopping ... 20:10:11.416 elasticsearch> [2016-03-09 20:10:11,416][INFO ][node ] [Epoch] stopped 20:10:11.416 elasticsearch> [2016-03-09 20:10:11,416][INFO ][node ] [Epoch] closing ... 20:10:11.423 elasticsearch> [2016-03-09 20:10:11,423][INFO ][node ] [Epoch] closed [ERROR] DOCKER> Cannot process chunk response: org.apache.http.MalformedChunkCodingException: Bad chunk header and then the build stalls

liufuyang commented 7 years ago

I seem to having the same issue when using the docker-maven-plugin to build and run a spring-boot docker image on jerkin, it output: [ERROR] DOCKER> Cannot process chunk response: org.apache.http.MalformedChunkCodingException: Unexpected content at the end of chunk

Maybe it is a jerkin issue or? Jenkins ver. 2.7.1

rhuss commented 7 years ago

What version of the plugin are you using ? Is there a way how I could reproduce it ?

vjkoskela commented 7 years ago

We are seeing the same thing. Using version 0.16.8.

Here is a minimal pom.xml running postgres which reproduces the problem. We are seeing it with two other internal docker images as well.

Tested against Docker version 1.10.3, build 9419b24-unsupported in Vagrant and Docker version 1.12.1 (build: 12133) natively on Mac -- same result.

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <artifactId>stop-example</artifactId>
  <groupId>com.example</groupId>
  <version>1.0.0-SNAPSHOT</version>
  <packaging>jar</packaging>

  <properties>
    <!-- Plugin versions -->
    <docker.maven.plugin.version>0.16.8</docker.maven.plugin.version>
  </properties>

  <build>
    <plugins>
      <plugin>
        <groupId>io.fabric8</groupId>
        <artifactId>docker-maven-plugin</artifactId>
        <version>${docker.maven.plugin.version}</version>
        <extensions>true</extensions>
        <executions>
          <execution>
            <id>default-start</id>
            <phase>pre-integration-test</phase>
            <goals>
              <goal>start</goal>
            </goals>
          </execution>
          <execution>
            <id>default-stop</id>
            <phase>post-integration-test</phase>
            <goals>
              <goal>stop</goal>
            </goals>
          </execution>
          <execution>
            <id>default-build</id>
            <phase>package</phase>
            <goals>
              <goal>build</goal>
            </goals>
          </execution>
          <execution>
            <id>default-remove</id>
            <phase>validate</phase>
            <goals>
              <goal>remove</goal>
            </goals>
            <configuration>
              <removeAll>true</removeAll>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <showLogs>true</showLogs>
          <images>
            <image>
              <name>postgres:9.6</name>
              <alias>postgres</alias>
              <run>
                <ports>
                  <port>5432:5432</port>
                </ports>
              </run>
            </image>
          </images>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

starting:

[villek:stop]$ mvn docker:start
Invoking system mvn
/usr/local/bin/mvn docker:start
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building stop-example 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> docker-maven-plugin:0.16.8:start (default-cli) > initialize @ stop-example >>>
[INFO]
[INFO] >>> docker-maven-plugin:0.16.8:remove (default-remove) > initialize @ stop-example >>>
[INFO]
[INFO] <<< docker-maven-plugin:0.16.8:remove (default-remove) < initialize @ stop-example <<<
[INFO]
[INFO] --- docker-maven-plugin:0.16.8:remove (default-remove) @ stop-example ---
[INFO]
[INFO] <<< docker-maven-plugin:0.16.8:start (default-cli) < initialize @ stop-example <<<
[INFO]
[INFO] --- docker-maven-plugin:0.16.8:start (default-cli) @ stop-example ---
[INFO] DOCKER> Pulling from library/postgres
6a5a5368e0c2: Pull complete
193f770cec44: Pull complete
33647077f2ee: Pull complete
53bc65f84840: Pull complete
a4d3b0f1c16a: Pull complete
bdbe3c2ddbbd: Pull complete
8f08971388d1: Pull complete
f80ab5df227d: Pull complete
7e724cee4193: Pull complete
fb0a1ee64973: Pull complete
484ac0d6f901: Pull complete
[INFO] DOCKER> Digest: sha256:924650288891ce2e603c4bbe8491e7fa28d43a3fc792e302222a938ff4e6a349
[INFO] DOCKER> Status: Downloaded newer image for postgres:9.6
[INFO] DOCKER> Pulled postgres:9.6 in 22 seconds
[INFO] DOCKER> [postgres:9.6] "postgres": Start container 13e54af4acc6
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 29.239 s
[INFO] Finished at: 2016-10-20T16:08:55+00:00
[INFO] Final Memory: 25M/491M
[INFO] ------------------------------------------------------------------------

container is running:

[villek:stop]$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
13e54af4acc6        postgres:9.6        "/docker-entrypoint.s"   13 seconds ago      Up 11 seconds       0.0.0.0:5432->5432/tcp   awesome_wozniak

stopping:

[villek:stop]$ mvn docker:stop
Invoking system mvn
/usr/local/bin/mvn docker:stop
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building stop-example 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> docker-maven-plugin:0.16.8:stop (default-cli) > initialize @ stop-example >>>
[INFO]
[INFO] >>> docker-maven-plugin:0.16.8:remove (default-remove) > initialize @ stop-example >>>
[INFO]
[INFO] <<< docker-maven-plugin:0.16.8:remove (default-remove) < initialize @ stop-example <<<
[INFO]
[INFO] --- docker-maven-plugin:0.16.8:remove (default-remove) @ stop-example ---
[INFO] DOCKER> [postgres:9.6] "postgres": Remove
[INFO]
[INFO] <<< docker-maven-plugin:0.16.8:stop (default-cli) < initialize @ stop-example <<<
[INFO]
[INFO] --- docker-maven-plugin:0.16.8:stop (default-cli) @ stop-example ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.114 s
[INFO] Finished at: 2016-10-20T16:09:19+00:00
[INFO] Final Memory: 26M/491M
[INFO] ------------------------------------------------------------------------

container is still running:

[villek:stop]$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
13e54af4acc6        654b61cc82aa        "/docker-entrypoint.s"   49 seconds ago      Up 48 seconds       0.0.0.0:5432->5432/tcp   awesome_wozniak
vjkoskela commented 7 years ago

I've reduced the example pom.xml file to:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <artifactId>stop-example</artifactId>
  <groupId>com.example</groupId>
  <version>1.0.0-SNAPSHOT</version>
  <packaging>jar</packaging>

  <properties>
    <!-- Plugin versions -->
    <docker.maven.plugin.version>0.16.8</docker.maven.plugin.version>
  </properties>

  <build>
    <plugins>
      <plugin>
        <groupId>io.fabric8</groupId>
        <artifactId>docker-maven-plugin</artifactId>
        <version>${docker.maven.plugin.version}</version>
        <extensions>true</extensions>
        <executions>
          <execution>
            <id>default-remove</id>
            <phase>validate</phase>
            <goals>
              <goal>remove</goal>
            </goals>
            <configuration>
              <removeAll>true</removeAll>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <images>
            <image>
              <name>postgres:9.6</name>
            </image>
          </images>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

The problem appears in this case to be the remove block. In particular the configuration to remove all (without that configuration stop works just fine).

rhuss commented 7 years ago

Thanks ! Just on my way back this week, will try to tackle it ASAP

Ville Koskela notifications@github.com schrieb am Do., 20. Okt. 2016, 18:29:

I've reduced the example pom.xml file to:

<?xml version="1.0" encoding="UTF-8"?>

4.0.0 stop-example com.example 1.0.0-SNAPSHOT jar 0.16.8 io.fabric8 docker-maven-plugin ${docker.maven. plugin.version} true default-remove validate remove true postgres:9.6

The problem appears in this case to be the remove block. In particular the configuration to remove all (without that configuration stop works just fine).

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/fabric8io/docker-maven-plugin/issues/406#issuecomment-255157252, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGDCCDj67kG-pAxWIoIsokL3xQBIx6Fks5q15bMgaJpZM4HtH8l .

seanyinx commented 7 years ago

i also have the same issue from time to time.

[INFO] DOCKER> [pojo-server:0.1.1-SNAPSHOT] "pojo-server": Start container 374d01572cc3
[INFO] DOCKER> [pojo-server:0.1.1-SNAPSHOT] "pojo-server": Waiting on url http://localhost:8080 with method GET for status 404.
[INFO] DOCKER> [pojo-server:0.1.1-SNAPSHOT] "pojo-server": Waited on url http://localhost:8080 and on log out 'Register microservice instance success' 5848 ms
[ERROR] DOCKER> Cannot process chunk response: java.io.IOException: Bad file descriptor

plugin version 0.20.0

michael-schnell commented 6 years ago

Any progress here? I'm facing the same problem.

krishnaraghavendra commented 6 years ago

Is there any resolution for this yet?

rhuss commented 6 years ago

No, not yet. Trying to work on this asap (but even 'asap' mean a bit later as I'm currently so busy with day to day work tasks)

mlvandijk commented 6 years ago

Am having the same issue when trying to start a docker with pubsub emulator:

[ERROR] DOCKER> Cannot process chunk response: java.io.IOException: Bad file descriptor
[ERROR] DOCKER> [xxxxxx": Timeout after 60359 ms while waiting on log out 'Pubsub emulator started'
[ERROR] DOCKER> Error occurred during container startup, shutting down...

Update: they do seem to start correctly. However, due to getting the error they are stopped. If I stop running by process by doing crtl + C after getting

[INFO] DOCKER> [xxxxxx] "gcloud-pubsub-emulator": Start container 41de4375f08a

but before

[ERROR] DOCKER> Cannot process chunk response: java.io.IOException: Bad file descriptor

and check that my dockers are running, by using docker ps on the command line, my test using the emulator actually passes.

nhooey commented 5 years ago

Did this ever get resolved?

rhuss commented 5 years ago

If someone is helping, maybe. I have no spare cycles to dig deeply into fixing docker:runissues, sorry. But it's open-source and a community project and I will happily guide anyone who wants to dive deeper.

'hope you understand.

rohanKanojia commented 5 years ago

@nhooey : Do you face it on 0.30.0 also?

nhooey commented 5 years ago

@rohanKanojia said: @nhooey : Do you face it on 0.30.0 also?

Not this particular issue, no. I had a different issue which the maintainer mentioned a solution to.

jacekwzg commented 4 years ago

I face it on 0.31.0, during stopping of postgres container, run by Jenkins:

`[INFO] --- docker-maven-plugin:0.31.0:stop (stop) @ xxxxxxx ---

[ERROR] DOCKER> IO Error while requesting logs: org.apache.http.MalformedChunkCodingException: Bad chunk header: HTTP/1.1 204 No Content Thread-2`