Member-only story
Running spring boot application in a docker container and connecting it to a containerized MySQL server
Sep 11, 2021
- First, create a MySQL container in docker
- create a common network so that spring boot and can also be added

- add MySQL container to the network

- create a Dockerfile in the root of spring boot
- add the following

- Next, in application.properties, change database url to the one in docker network

- Then, build the application using mvn clean install
- Build spring boot docker image

- Run the image we just built

- Test the API is working
