br4chu / docker-compose-maven-plugin

Maven plugin that talks to docker-compose command-line interface
Apache License 2.0
12 stars 4 forks source link

"Cluster is already up" returned #2

Closed clement-igonet closed 4 years ago

clement-igonet commented 5 years ago

What to do when I get this message ? I've restarted my docker service to be clean. No improvement.

[ERROR] Failed to execute goal io.brachu:docker-compose-maven-plugin:0.6.0:up (docker-compose) on project commodityvariantchecker: Execution docker-compose of goal io.brachu:docker-compose-maven-plugin:0.6.0:up failed: Cluster is already up -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.brachu:docker-compose-maven-plugin:0.6.0:up (docker-compose) on project commodityvariantchecker: Execution docker-compose of goal io.brachu:docker-compose-maven-plugin:0.6.0:up failed: Cluster is already up
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution docker-compose of goal io.brachu:docker-compose-maven-plugin:0.6.0:up failed: Cluster is already up
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
        ... 20 more
Caused by: java.lang.IllegalArgumentException: Cluster is already up
        at org.apache.commons.lang3.Validate.isTrue(Validate.java:158)
        at io.brachu.johann.cli.DockerComposeCli.up(DockerComposeCli.java:49)
        at io.brachu.docker.compose.plugin.UpMojo.up(UpMojo.java:25)
        at io.brachu.docker.compose.plugin.UpMojo.execute(UpMojo.java:18)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        ... 21 more
mjagus commented 5 years ago

Hello,

The plugin considers the cluster to be up when a command docker-compose -f path_to_your_compose_file -p your_project_name ps -q returns at least a single container id, even if that container is down.

The error you are referring to may happen if a previous maven run didn't shut down the docker-compose cluster properly. You can clean it up manually with docker-compose -f path_to_your_compose_file -p your_project_name down command. There is also a possiblity that you are using an explicit project name in the plugin's configuration which conflicts with a project name of another docker-compose cluster that's running on your machine. Unfortunetly I can't tell much more without looking at how you configured the plugin.

mjagus commented 4 years ago

Closing due to inactivity.