How to push the docker image to docker hub using dockerfile and spotify maven plugin
Steps:
- Go to https://start.spring.io/ and create a spring boot project with spring web dependency.
- Download the project and open in any othe the ID. i.e - intellij Idea
- Change the port in application.properties file. - server.port=9091
- Create a HomeController and add a expose a endpoint.
- Create docker file and add the content below in the docker file.
- Add the spotify maven plugin in the plugins tab and change the repo name and image name. please refer the pom.xml plugins section.
- Verify docker is intalled and running in your local system. docker -v
- Login to dockerhub and verify the repository. same name repository should not already exists.
- Go to intellij idea and goto terminal and run the below command mvn clean package dockerfile:push
- if no error image should be push to docker hub. veify the image in the dockerhub