Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-31646

Stop and remove docker container post build action is not working : it is stopped but not removed

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Critical
    • Resolution: Unresolved
    • Labels:
      None
    • Environment:
      docker 1.9.0, 1.8.2, 1.8.1
      Jenkins 1.625.2
      docker-build-step 1.32
    • Similar Issues:

      Description

      For a freshly creater mysql container (create container and then start container in build steps), when I try to remove it in post-build actions, I get the following error message (and the container is not removed) :

      [Docker] INFO: created container id ca1d14fe848e67298f7c507473d9f732e159b3e400d04f15db781717bdc5214e (from image mysql:5.7)
      [Docker] INFO: started container id dpui-for-jenkins
      ...
      [info] Done packaging.
      [success] Total time: 1 s, completed Nov 19, 2015 9:13:33 AM

      [Docker] INFO: stopped container id dpui-for-jenkins
      ERROR: Build step failed with exception
      com.github.dockerjava.api.InternalServerErrorException: Cannot kill container dpui-for-jenkins: notrunning: Container ca1d14fe848e67298f7c507473d9f732e159b3e400d04f15db781717bdc5214e is not running

      at com.github.dockerjava.core.util.ResponseStatusExceptionFilter.filter(ResponseStatusExceptionFilter.java:54)
      at org.glassfish.jersey.client.ClientFilteringStages$ResponseFilterStage.apply(ClientFilteringStages.java:134)
      at org.glassfish.jersey.client.ClientFilteringStages$ResponseFilterStage.apply(ClientFilteringStages.java:123)
      at org.glassfish.jersey.process.internal.Stages.process(Stages.java:171)
      at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:251)
      at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:667)
      at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:664)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:228)
      at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:424)
      at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:664)
      at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:424)
      at org.glassfish.jersey.client.JerseyInvocation$Builder.post(JerseyInvocation.java:333)
      at com.github.dockerjava.jaxrs.KillContainerCmdExec.execute(KillContainerCmdExec.java:32)
      at com.github.dockerjava.jaxrs.KillContainerCmdExec.execute(KillContainerCmdExec.java:11)
      at com.github.dockerjava.jaxrs.AbstrDockerCmdExec.exec(AbstrDockerCmdExec.java:57)
      at com.github.dockerjava.core.command.AbstrDockerCmd.exec(AbstrDockerCmd.java:29)
      at com.github.dockerjava.core.command.KillContainerCmdImpl.exec(KillContainerCmdImpl.java:55)
      at org.jenkinsci.plugins.dockerbuildstep.cmd.RemoveCommand.execute(RemoveCommand.java:65)
      at org.jenkinsci.plugins.dockerbuildstep.DockerPostBuilder$DockerPostBuildStep.perform(DockerPostBuilder.java:84)
      at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:785)
      at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:726)
      at hudson.model.Build$BuildExecution.post2(Build.java:185)
      at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:671)
      at hudson.model.Run.execute(Run.java:1766)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      at hudson.model.ResourceController.execute(ResourceController.java:98)
      at hudson.model.Executor.run(Executor.java:408)
      Build step 'Stop and remove Docker container' marked build as failure
      Finished: FAILURE

      *The container is then stopped but not removed * So when the build is restarted, it directly fail on container creation as a container with the same name already exists.

        Attachments

          Activity

          There are no comments yet on this issue.

            People

            • Assignee:
              vjuranek vjuranek
              Reporter:
              crodav david crosson
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: