-
Bug
-
Resolution: Unresolved
-
Critical
-
None
-
docker 1.9.0, 1.8.2, 1.8.1
Jenkins 1.625.2
docker-build-step 1.32
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.