MySQL 데이터베이스로 Spring Boot 애플리케이션을 도커화하는 가이드
5256 단어 javamysqldockerspringboot
이 기사에서는 AWS EC2 Linux 인스턴스를 사용하지만 설치 부분을 제외하고 모든 명령은 다른 OS에서도 유사합니다.
https://docs.docker.com/engine/install/ubuntu/
docker -v

docker info

docker pull mysql:5.7

docker images

docker network create springboot-mysql-net

docker run -it --name mysqldb --network=springboot-mysql-net -e MYSQL_ROOT_PASSWORD=1234 -e MYSQL_DATABASE=expensetracker -e MYSQL_USER=sys -e MYSQL_PASSWORD=1234 -d mysql:5.7

구문:
docker exec -it <container-id> bash
docker exec -it 81e7 bash
mysql -u sys -p 1234
show databases;

# MySQL properties
spring.datasource.url=jdbc:mysql://mysqldb:3306/expensetracker
spring.datasource.username=sys
spring.datasource.password=1234


docker build -t springbootmysql .

docker run --network=springboot-mysql-net --name springboot-container -p 8080:8080 -d springbootmysql


계정이 생성되면
docker login
명령을 사용하여 도커 허브에 로그인합니다.
docker push devanandukalkar/springbootmysql


이 기사가 도움이 되었기를 바랍니다. 댓글 섹션에서 피드백을 알려주세요.
Reference
이 문제에 관하여(MySQL 데이터베이스로 Spring Boot 애플리케이션을 도커화하는 가이드), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/devanandukalkar/guide-to-dockerize-your-spring-boot-application-with-mysql-b9g텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)