Member-only story

Running spring boot application in a docker container and connecting it to a containerized MySQL server

theoneamin
Sep 11, 2021
  • First, create a MySQL container in docker
  • create a common network so that spring boot and can also be added
command to create a network called my_network
  • add MySQL container to the network
add MySQL to the network
  • create a Dockerfile in the root of spring boot
  • add the following
Dockerfile
  • Next, in application.properties, change database url to the one in docker network
application.properties
  • Then, build the application using mvn clean install
  • Build spring boot docker image
  • Run the image we just built
  • Test the API is working

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

theoneamin
theoneamin

No responses yet

Write a response