Relative Content

Tag Archive for spring-bootdocker

How can I connect Spring Boot and MariaDB docker containers in docker-compose?

I’m working on a Spring Boot API and I’m running into some issues getting my application to work in a docker container. My goal is to deploy the app to DigitalOcean, but I’m getting a pretty generic connection error when I try to run it in docker. When I run it locally, there are no issues and the Swagger docs are available at http://localhost:8080/swagger-ui/index.html, but when I run it via docker compose up --build, I get the stack trace below. I assume there’s a problem with the hostname I’m using somewhere. Sorry if this is a noob question but I’ve done a lot of googling, read the similar SO questions and watched every Spring Boot tutorial I could find and I still haven’t been able to get it to work.

Unable to start API from within Docker container

I’m trying to deploy my Spring Boot application and when I run the API on my local machine using mvn spring-boot:run or java -jar PATH it works just fine. But when I try to run it in a Docker container I get the stack trace below. I get the same exact stack trace outside the container when I run the command service mariadb stop then run my app, but I’m not really sure what this means. What could be causing this?