MariaDb 데이터 복사
cp -R /opt/homebrew/var/mysql ./mysql_data
MariaDb DockerFile 생성
FROM mariadb
ENV MYSQL_ROOT_PASSWORD [password]
ENV MYSQL_DATABASE [database이름]
COPY ./mysql_data /var/lib/mysql
EXPOSE 3306
ENTRYPOINT ["mysqld","--user=root"]
MariaDb Docker 빌드
docker build -t puk0806/gugbab-mariadb:0.0.1 .
MariaDb Docker Image 생성
docker run -d -p 3306:3306 --network gugbab-network --name mariadb puk0806/gugbab-mariadb:0.0.1
MariaDb Docker 권한 설정
- bash 실행
- db 접속
- 권한 설정
docker exec -it mariadb /bin/bash
mysql -hlocalhost -uroot -p
grant all privileges on *.* to 'root'@'%' identified by '[passwod]'
flush priviliges;
exit;
'DevOps' 카테고리의 다른 글
[Dcoker] Zipkin, Monitoring(Prometheus + Grafana) Container Create Example (0) | 2023.05.31 |
---|---|
[Docker]Kafka + Zookeeper docker-compose Example (0) | 2023.05.30 |
[Docker] RabbitMq Docker Create Connect Example (0) | 2023.05.22 |
[Docker] Bridge Network Create Example (0) | 2023.05.20 |
[Docker] Spring Boot - Image Upload, DockerFile Example (0) | 2023.05.18 |