mohammad haseeb
mohammad haseeb

Reputation: 1

I am Dockerizing my Spring boot application and i am getting connection refusal errors

Here is my project

https://github.com/haseeb1988/spRegistration.git

// Creating network docker network create -d bridge sp-sql-net

// build images

docker build -t springboot_website .

//run container

docker run --network sp-sql-net --name springboot_mysql_container_rest -p 8080:8080 springboot_website

Problem:

I'm encountering an issue with my application. It works perfectly on my local machine, connecting to a MySQL database running in a Docker container. However, when I try to run my application inside a Docker container while using the same MySQL container, the application fails to start. I've tried both Docker commands and Docker Compose, but neither approach resolves the problem. Any insights or suggestions would be greatly appreciated!

I've tried both Docker commands and Docker Compose, but neither approach resolves the problem. and i am expecting solution.

Upvotes: -1

Views: 27

Answers (1)

habib ammar
habib ammar

Reputation: 56

both mysql and springboot_website have to run in the same network sp-sql-net .

Please provide mysql config in your app and the run command for mysql container.

Upvotes: 0

Related Questions