0

I'm using the avast / gradle-docker-compose-plugin - https://github.com/avast/gradle-docker-compose-plugin in my project here - https://github.com/johnnyalpha8/Pet-Shop/blob/main/build.gradle.kts .

My project is a SpringBoot Kotlin API. I believe I have configured the plugin correctly. I have added it to the plugins block of my build.gradle.kts -

plugins {
    ...
    id("com.avast.gradle.docker-compose") version "0.15.2"
}

Now when I try out the new task ./gradlew composeUp the container starts up just fine, but then immediately shuts down and the build fails with -

Starting process 'command 'docker-compose''. Working directory: /home/charliejade/dev/apps/reactiveKotlin-source-code Command: docker-compose --no-ansi -p 649e9eedea35a6b45cffd19a30f272cd_reactiveKotlin_ config --services
Successfully started process 'command 'docker-compose''
Starting process 'command 'docker-compose''. Working directory: /home/charliejade/dev/apps/reactiveKotlin-source-code Command: docker-compose --no-ansi -p 649e9eedea35a6b45cffd19a30f272cd_reactiveKotlin_ ps --services
Successfully started process 'command 'docker-compose''
List containers.

Usage: ps [options] [SERVICE...]

Options:
    -q    Only display IDs
Starting process 'command 'docker-compose''. Working directory: /home/charliejade/dev/apps/reactiveKotlin-source-code Command: docker-compose --no-ansi -p 649e9eedea35a6b45cffd19a30f272cd_reactiveKotlin_ config --services
Successfully started process 'command 'docker-compose''
Starting process 'command 'docker-compose''. Working directory: /home/charliejade/dev/apps/reactiveKotlin-source-code Command: docker-compose --no-ansi -p 649e9eedea35a6b45cffd19a30f272cd_reactiveKotlin_ stop --timeout 10 myservice mariadb
Successfully started process 'command 'docker-compose''
Stopping 649e9eedea35a6b45cffd19a30f272cdreactivekotlin_mariadb_1   ... 
Stopping 649e9eedea35a6b45cffd19a30f272cdreactivekotlin_myservice_1 ... 
Stopping 649e9eedea35a6b45cffd19a30f272cdreactivekotlin_myservice_1 ... done
Stopping 649e9eedea35a6b45cffd19a30f272cdreactivekotlin_mariadb_1   ... done
Starting process 'command 'docker-compose''. Working directory: /home/charliejade/dev/apps/reactiveKotlin-source-code Command: docker-compose --no-ansi -p 649e9eedea35a6b45cffd19a30f272cd_reactiveKotlin_ down --volumes
Successfully started process 'command 'docker-compose''
Removing 649e9eedea35a6b45cffd19a30f272cdreactivekotlin_mariadb_1   ... 
Removing 649e9eedea35a6b45cffd19a30f272cdreactivekotlin_myservice_1 ... 
Removing 649e9eedea35a6b45cffd19a30f272cdreactivekotlin_myservice_1 ... done
Removing 649e9eedea35a6b45cffd19a30f272cdreactivekotlin_mariadb_1   ... done
Removing volume 649e9eedea35a6b45cffd19a30f272cdreactivekotlin_mariadb_data

> Task :composeUp FAILED
:composeUp (Thread[Execution worker for ':',5,main]) completed. Took 1 mins 18.015 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':composeUp'.
> Exit-code 1 when calling docker-compose, stdout: 

* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 19s

Gradle Scan - https://scans.gradle.com/s/ealbm2cysvi42

Full debug logs with stacktrace can be found here - https://github.com/johnnyalpha8/Pet-Shop/issues/1

I am using -

  • Linux Mint 19.3 Tricia as my OS.
  • Kotlin v1.6.20
  • docker-compose version 1.17.1

I should add that my services start correctly when done manually with docker-compose up docker-compose.yml. My docker-compose.yml file has two services, mariadb + my Kotlin REST API. I've tried ./gradlew composeUp with just mariadb in the docker-compose file and I get the same result.

Feel free to checkout the code from here - https://github.com/johnnyalpha8/Pet-Shop and try it out for yourself :(

I am quite stumped, but don't want to give up on the plugin just yet :)! Any insight into what is wrong would be appreciated!

11
  • 1
    Can you include your docker-compose.yml file? Apr 18, 2022 at 8:02
  • 1
    What error do you get when you directly run docker-compose up from the command line? This is usually what I do to debug that kind of problem when using this plugin. Apr 18, 2022 at 8:06
  • 1
    To see the actual underlying problem, you will need to run docker-compose up from the command line (not with Gradle), and post the errors that you get from that. Gradle logs do not show the underlying problem. Can you post that output as requested? Apr 19, 2022 at 8:20
  • 1
    So you did. I overlooked that. What I do see in the Gradle log is that it seems to execute these commands docker-compose -p 649e9eedea35a6b45cffd19a30f272cd_reactiveKotlin_ version --short and docker-compose --no-ansi -p 649e9eedea35a6b45cffd19a30f272cd_reactiveKotlin_ build. I suspect that these commands are truncated, but you may have some containers that were left running from a previous Gradle execution. If you do docker ps -a are there any containers running that have something similar to "649e9eedea35a6b45cffd19a30f272cd" in the name? Apr 19, 2022 at 8:44
  • 1
    Try a couple of things: 1) ./gradlew composeDown if that does not work try docker-compose -p 649e9eedea35a6b45cffd19a30f272cd_reactiveKotlin_ kill and if that still does not work try 3) find all running containers with docker ps -a and stop and rm them manually. Apr 19, 2022 at 8:47

0

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.