docker mariadb 설치# Virtualation/Docker2021. 8. 4. 14:16
Table of Contents
728x90
반응형
설치환경
[root@darksharavim ~]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
도커 설치
[root@darksharavim ~]# yum -y install docker
도커 서비스 상태확인
[root@darksharavim ~]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Docs: http://docs.docker.com
도커 서비스 시작 및 상태확인
[root@darksharavim ~]# systemctl start docker
[root@darksharavim ~]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: active (running) since 수 2021-08-04 14:17:18 KST; 39s ago
Docs: http://docs.docker.com
Main PID: 1619 (dockerd-current)
CGroup: /system.slice/docker.service
├─1619 /usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --exec-opt native.cgroupdriver=systemd ...
└─1625 /usr/bin/docker-containerd-current -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --state-dir /var/run/d...
8월 04 14:17:18 darksharavim dockerd-current[1619]: time="2021-08-04T14:17:18.104635929+09:00" level=warning msg="Docker could not enable SELinux on the host system"
8월 04 14:17:18 darksharavim dockerd-current[1619]: time="2021-08-04T14:17:18.116765974+09:00" level=info msg="Graph migration to content-addressability took 0.00 seconds"
8월 04 14:17:18 darksharavim dockerd-current[1619]: time="2021-08-04T14:17:18.117256920+09:00" level=info msg="Loading containers: start."
8월 04 14:17:18 darksharavim dockerd-current[1619]: time="2021-08-04T14:17:18.137809183+09:00" level=info msg="Firewalld running: false"
8월 04 14:17:18 darksharavim dockerd-current[1619]: time="2021-08-04T14:17:18.163142152+09:00" level=info msg="Default bridge (docker0) is assigned with an IP address...P address"
8월 04 14:17:18 darksharavim dockerd-current[1619]: time="2021-08-04T14:17:18.178226646+09:00" level=info msg="Loading containers: done."
8월 04 14:17:18 darksharavim dockerd-current[1619]: time="2021-08-04T14:17:18.217522062+09:00" level=info msg="Daemon has completed initialization"
8월 04 14:17:18 darksharavim dockerd-current[1619]: time="2021-08-04T14:17:18.217550762+09:00" level=info msg="Docker daemon" commit="7d71120/1.13.1" graphdriver=over...ion=1.13.1
8월 04 14:17:18 darksharavim systemd[1]: Started Docker Application Container Engine.
8월 04 14:17:18 darksharavim dockerd-current[1619]: time="2021-08-04T14:17:18.226735593+09:00" level=info msg="API listen on /var/run/docker.sock"
Hint: Some lines were ellipsized, use -l to show in full.
마리아DB 이미지 검색 및 다운로드
[root@darksharavim ~]# docker search mariaDB
INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED
docker.io docker.io/mariadb MariaDB Server is a high performing open s... 4259 [OK]
docker.io docker.io/linuxserver/mariadb A Mariadb container, brought to you by Lin... 232
docker.io docker.io/toughiq/mariadb-cluster Dockerized Automated MariaDB Galera Cluste... 41 [OK]
docker.io docker.io/mariadb/server MariaDB Server is a modern database for mo... 37 [OK]
docker.io docker.io/colinmollenhour/mariadb-galera-swarm MariaDb w/ Galera Cluster, DNS-based servi... 33 [OK]
docker.io docker.io/panubo/mariadb-galera MariaDB Galera Cluster 22 [OK]
docker.io docker.io/webhippie/mariadb Docker images for MariaDB 22 [OK]
docker.io docker.io/arm64v8/mariadb MariaDB Server is a high performing open s... 19
docker.io docker.io/lsioarmhf/mariadb ARMHF based Linuxserver.io image of mariadb 17
docker.io docker.io/bianjp/mariadb-alpine Lightweight MariaDB docker image with Alpi... 15 [OK]
docker.io docker.io/mariadb/maxscale MariaDB MaxScale - The world's most advanc... 14 [OK]
docker.io docker.io/centos/mariadb-101-centos7 MariaDB 10.1 SQL database server 12
docker.io docker.io/jc21/mariadb-aria Extension of the mariadb image that forces... 10
docker.io docker.io/centos/mariadb-102-centos7 MariaDB 10.2 SQL database server 6
docker.io docker.io/wodby/mariadb Alpine-based MariaDB container image with ... 6 [OK]
docker.io docker.io/tiredofit/mariadb-backup MariaDB Backup image to backup MariaDB/MyS... 5 [OK]
docker.io docker.io/clearlinux/mariadb MariaDB relational database management sys... 2 [OK]
docker.io docker.io/jonbaldie/mariadb Fast, simple, and lightweight MariaDB Dock... 2 [OK]
docker.io docker.io/kitpages/mariadb-galera MariaDB with Galera 2 [OK]
docker.io docker.io/rightctrl/mariadb Mariadb with Galera support 2 [OK]
docker.io docker.io/tiredofit/mariadb Docker MariaDB server w/ S6 Overlay, Zabbi... 2 [OK]
docker.io docker.io/centos/mariadb-103-centos7 MariaDB 10.3 SQL database server 1
docker.io docker.io/ansibleplaybookbundle/mariadb-apb An APB which deploys RHSCL MariaDB 0 [OK]
docker.io docker.io/demyx/mariadb Non-root Docker image running Alpine Linux... 0
docker.io docker.io/jelastic/mariadb An image of the MariaDB SQL database serve... 0
[root@darksharavim ~]# docker pull docker.io/mariadb
Using default tag: latest
Trying to pull repository docker.io/library/mariadb ...
latest: Pulling from docker.io/library/mariadb
16ec32c2132b: Pull complete
cbf20e69555c: Pull complete
a69afd1ffc85: Pull complete
5e720dc7fcd8: Pull complete
3a81d177e410: Pull complete
827c8c103c89: Pull complete
2108ccd01374: Pull complete
daa89fc536ce: Pull complete
5313da4066cc: Pull complete
2ed11818346e: Pull complete
Digest: sha256:3b6f9fa1d406e168998d62501b2ee4f27d53138bebfcdac03540758996c5ff1d
Status: Downloaded newer image for docker.io/mariadb:latest
[root@darksharavim ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/mariadb latest fd17f5776802 8 days ago 409 MB
마리아DB 컨테이너 구동
[root@darksharavim data]# docker run \
> -d \
> --name=mariadb \
> -v /data:/var/lib/mysql \
> -p 3306:3306 \
> -e MYSQL_ROOT_PASSWORD=mariadb \
> mariadb
dd5ea8ec70452c4f5eb12ee6b61c5966d0577948e02ecc77363e2671acf02e19
주의! 마운트 옵션을 설정하지 않으면 컨테이너 삭제시 데이터가 날아감!
컨테이너 확인
[root@darksharavim data]# docker inspect mariadb
..
"Mounts": [
{
"Type": "bind",
"Source": "/data",
"Destination": "/var/lib/mysql",
"Mode": "",
"RW": true,
"Propagation": "rprivate"
},
..
컨테이너 상태 확인
[root@darksharavim data]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a38caadf22f4 mariadb "docker-entrypoint..." 2 minutes ago Up 2 minutes 0.0.0.0:3306->3306/tcp mariadb
[root@darksharavim data]# netstat -nl | grep 3306
tcp6 0 0 :::3306 :::* LISTEN
[root@darksharavim data]# ps -ef | grep docker |grep 3306
root 3923 1619 0 15:08 ? 00:00:00 /usr/libexec/docker/docker-proxy-current -proto tcp -host-ip 0.0.0.0 -host-port 3306 -container-ip 172.17.0.2 -container-port 3306
마리아DB컨테이너 터미널접속
[root@darksharavim data]# docker exec -it mariadb /bin/bash
root@a38caadf22f4:/#
728x90
반응형
'# Virtualation > Docker' 카테고리의 다른 글
docker 컨테이너에서 vi 사용 (0) | 2021.08.05 |
---|---|
docker mssql 2019 설치 (0) | 2021.08.05 |
docker 기본 명령어 (0) | 2021.04.01 |
docker 파일을 이용한 ubuntu 및 openjdk 설치 (0) | 2021.03.31 |
docker 및 웹기반 관리도구 portainer 설치 (0) | 2021.03.26 |
@다크쉐라빔 :: 다크쉐라빔의 주절주절
안녕하세요. 이곳은 IT위주의 잡다한 정보를 올려두는 개인 블로그입니다.
포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!