Public Repository

Last pushed: 2 months ago
Short Description
springboot_docker_tomcat
Full Description

This is sample project that uses

  • springboot
  • database mysql
  • docker
  • maven + java8

full source code : https://github.com/sophea/spring-boot-docker-mysql

First, clone the project and build locally:

git clone https://github.com/sophea/spring-boot-docker-mysql.git
cd spring-boot-docker-mysql

mvn clean package docker:build
Run MySQL 5.7 in Docker container:

docker run --name demo-mysql -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=demo -e MYSQL_USER=demo_user -e MYSQL_PASSWORD=demo_pass -p 3306:3306 -d mysql:5.7
Check the log to make sure the server is running OK:

docker logs demo-mysql
Run demo application in Docker container and link to demo-mysql:

docker run -p 8080:8080 --name web-app --link demo-mysql:mysql -d sopheamak/springboot_docker_mysql

You can check the log by

docker logs demo-app
To push the image you just built to the registry, specify the pushImage flag.

mvn clean package docker:build -DpushImage

check docker logs

docker logs dockerwar

more about docker plugin with maven : https://github.com/spotify/docker-maven-plugin#authentication

Docker-compose

To run this you need to install docker-compose first

cd target/docker
docker-compose up -d

Docker Pull Command
Owner
sopheamak

Comments (0)