Spring boot with Docker and Mysql without Docker

Asked

Viewed 155 times

-1

I have a java application with spring boot and mysql, I put my application running in Docker container but I don’t want mysql to be in Docker.

The problem is that I am not getting my application to connect to mysql that is installed on the host.

follows my Dockerfile:

FROM adoptopenjdk/openjdk11:latest

RUN mkdir /etc/app  
VOLUME /tmp

COPY app.jar /etc/app
COPY application.properties /etc/app
COPY application-prod.properties /etc/app

ENTRYPOINT [ "java" , "-Djava.security.egd=file:/dev/./urandom", "-Dspring.profiles.active=prod", "-jar" ,"/etc/app/app.jar"]

I wonder if it’s possible

  • Have you ever worked with Docker-Composer? If not, try to make your connection through Docker-Compose.yml

1 answer

0


You need to upload the container of your application by pointing the ip of your machine on the local network as the host of the database.

Or you can climb with the parameter --net host

Browser other questions tagged

You are not signed in. Login or sign up in order to post.