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!
docker-compose.yml
file?docker-compose up
from the command line? This is usually what I do to debug that kind of problem when using this plugin.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?docker-compose -p 649e9eedea35a6b45cffd19a30f272cd_reactiveKotlin_ version --short
anddocker-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 dodocker ps -a
are there any containers running that have something similar to "649e9eedea35a6b45cffd19a30f272cd" in the name?./gradlew composeDown
if that does not work trydocker-compose -p 649e9eedea35a6b45cffd19a30f272cd_reactiveKotlin_ kill
and if that still does not work try 3) find all running containers withdocker ps -a
and stop and rm them manually.