New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Container name pattern ignored when stopping #1168
Comments
I've created a sample project to demonstrate the issue: https://github.com/jakub-bochenski/demp-concurrent-stop This is a major blocker for me, so I would appreciate at least some hints on how to work around this. |
Looking at https://github.com/fabric8io/docker-maven-plugin/blob/master/src/main/java/io/fabric8/maven/docker/util/ContainerNamingUtil.java#L66 there is no code to differentiate images created with different name patterns. Seems like the only thing that matters is GAV and the image used for the container. The name pattern is not taken into account to differentiate containers. This is not what the documentation suggests
Would you accept a PR that would change it, so that only containers started with the same name pattern would be considered? |
Sorry for the long delay, but yes, it sounds like a very valid bug. If you would send a PR, that would be awesome. Currently I have a bit of a time window to work on d-m-p, so happy to get a fix in quickly. |
OK, thanks |
thanks, I totally understand and happy that you found a solution. I keep that bug open, maybe someone else wants to jump on it. |
We have a similar issue but in our case the containerNamePattern is just %a. I can provide a fix for that and maybe I can also try to fix the original issue. |
Regarding the original issue, in case the containerNamePattern contains the %i or %t placeholder then we probably cannot fix it easily. |
I think that would be appreciated. Unfortunately I think I won't be able to work on it any time soon |
The current implementation treats index placeholders specially. All containers are stopped except the one with the highest index (see https://github.com/fabric8io/docker-maven-plugin/blob/master/src/main/java/io/fabric8/maven/docker/util/ContainerNamingUtil.java#L85). Why is this necessary? I don't get it. However, for me it's not clear how we should handle the stopping process when the containerNamePattern contains %i or %t. Both parameters are automatically generated (see Proposal:
|
…ainers are stopped
…e stopped (#1427) Co-authored-by: Jens Thielscher <jens.thielscher@sabio.de> Co-authored-by: Roland Huß <roland@ro14nd.de>
Description
I want to run concurrent builds on a single docker host (for CI).
I started two builds with
-Ddocker.containerNamePattern="$BUILD_TAG-%n-%i"
(e.g.-Ddocker.containerNamePattern=build-1-%n-%i
and-Ddocker.containerNamePattern=build-2-%n-%i
).I expected the builds to ignore each other's containers, only stopping the ones that match their respective build pattern, but instead they stop each other's containers.
This results in errors because containers being stopped mid-use.
While in the other build log there is
Info
mvn -v
) : 3.5The text was updated successfully, but these errors were encountered: