테스트 DB를 구성하는데 있어 보다 편하게 하고싶어서 Docker 이미지를 생성하고 해당 이미지로 Container DB 생성을 해보았습니다.
이후에 해당 이미지를 이요하여 Container Replication을 구성해 볼 예정입니다.
[root@pmm-server ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
508674e5261a centos:7 "/bin/bash" 8 minutes ago Up 8 minutes centos7
4c349fab5687 centos "/bin/bash" 58 minutes ago Up 57 minutes centos
44eeafff66ca percona/pmm-server:2 "/opt/entrypoint.sh" 13 days ago Up About an hour (healthy) 0.0.0.0:8080->80/tcp, 0.0.0.0:10443->443/tcp pmm-server
### Container 설정
[root@pmm-server ~]# docker exec -it centos7 /bin/bash
( MySQL8 버전 설치 )
### Docker Image 생성
[root@pmm-server ~]# docker commit -a "leeyun" centos7 leeyunhyeong/mysql8:1
sha256:813b7347310b844852f4a3e89e09dcb206ad7b01632afd8e66b71ce771a0cde8
### Docker Image 테스트
[root@pmm-server ~]# docker run -it --name my -d leeyunhyeong/mysql8:1
[root@pmm-server ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
19372ea06f51 leeyunhyeong/mysql8:1 "/bin/bash" 5 minutes ago Up 5 minutes my
[root@pmm-server ~]# docker exec -it my /bin/bash
### Docker Hub 넣기
[root@pmm-server ~]# docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: leeyunhyeong
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
[root@pmm-server ~]# docker push leeyunhyeong/mysql8:1
The push refers to repository [docker.io/leeyunhyeong/mysql8]
3590a870c6c8: Pushed
174f56854903: Pushed
1: digest: sha256:5870ca603617e7381c8b9fdaf37721368a716caa19818f62b8806ec0a074db82 size: 743
[root@pmm-server ~]# docker pull leeyunhyeong/mysql8:1
1: Pulling from leeyunhyeong/mysql8
2d473b07cdd5: Already exists
90be23feaba8: Already exists
Digest: sha256:5870ca603617e7381c8b9fdaf37721368a716caa19818f62b8806ec0a074db82
Status: Downloaded newer image for leeyunhyeong/mysql8:1
docker.io/leeyunhyeong/mysql8:1