문서유형ㅣ기술정보
분야ㅣ인터페이스/연동
적용제품버전 l Tibero6 전체, Tibero7 전체
문서번호ㅣTIITI071
개요
도커(Docker)는 OS에서 필요로 하는 필수 라이브러리(커널)를 Host OS와 Container간에 공유하여 불필요한 리소스 및 부가 단계가 제거되어 네이티브(Bare-Metal환경)에 가까운 환경을 제공합니다.
VM 보다 가볍고 좀 더 유연하고 빠르게 Software(APP)을 동작 시키는 환경을 제공/이용할 수 있고, 보다 간편하게 DBMS를 설치할 수 있습니다.
본 문서에서는 Docker 환경 구성 및 Docker를 사용한 RDBMS 포팅 방법을 안내합니다.
방법
가상화와 Docker Container 환경
Bare-Metal (VM)
일반적으로 기술지원 중 VM환경이라고 칭하는 것은 Bare-Metal 가상화 환경입니다.
가상화 OS(Hypervisor)를 기반으로 VM이 생성/관리/운영 되며, 독립적인 VM은 가상화 OS 커널에 의해 동작 합니다.
- Virtualization Layer (Hypervisor) : VMware ESXi, Redhat RHEV, Citrix XenServer, Microsoft Hyper-V
Hosted (VM)
테스트를 위해 가장 많이 활용하는 가상화 환경에 해당합니다.
HOST OS (Windows/Mac/Linux)에 가상화 소프트웨어를 설치하여, VM을 사용하는 환경입니다.
- Virtualization Layer (가상화 소프트웨어): VMware Workstation, Oracle Virtual Box, Parallels Desktop
Container
Kubernetes, Hyper Cloud, Redhat Orchestration, VMware Tanzu, ManTech Accordion등과 같은 환경을 이용한다면 Container 기반이 되는 환경입니다.
참고
관련 상세사항은 아래 링크에서 확인할 수 있습니다.
Docker 링크
Docker 설치
Docker Engine: Daemon, Docker Command: CLI, Docker User Interface : GUI 세가지 기능으로 버전이 분리 됩니다.
|
※ 테스트 환경에 따라 구성에 맞는 버전을 설치하여 사용합니다.
|
| Docker Desktop Windows or Mac | Docker Engine (Windows) | Docker Engine (Linux/Mac) |
Docker Home : https://www.docker.com/
Docker Installation Manual : https://docs.docker.com/get-docker/
시스템 요구 사항
|
Windows
Mac
Linux
|
Docker Life Cycle
| Command | Content |
| pull | Image를 Docker hub(public) 또는 Registry(private)에서 다운로드 |
| create | Image를 통해 Container를 생성 |
| - pull 생략 가능 | |
| start | 생성된 Container를 기동 |
| stop | 기동된 Container를 중지 |
| run | Image를 통해 Container를 생성하고 기동 |
| - pull, create, start 생략 가능 | |
| rm | Image를 로컬 저장소에서 삭제하거나 중지된 Container를 삭제 |
| commit | 중지된 Container를 Image에 반영 |
Docker HUB(Public) URL: https://hub.docker.com/
- 원하는 이미지 검색
CentOS 7.9.2009 버전으로 Container 기본 다루기
| Docker Image pull |
|
PS C:\work> docker images REPOSITORY TAG IMAGE ID CREATED SIZE
PS C:\work> docker pull centos:7.9.2009 7.9.2009: Pulling from library/centos 2d473b07cdd5: Pull complete Digest:sha256:c73f515d06b0fa07bb18d8202035e739a494ce760aa73129f60f4bf2bd22b407 Status: Downloaded newer image for centos:7.9.2009 docker.io/library/centos:7.9.2009
PS C:\work> docker images REPOSITORY TAG IMAGE ID CREATED SIZE centos 7.9.2009 eeb6ee3f44bd 8 months ago 204MB |
| Docker Container Create |
|
PS C:\work> docker images REPOSITORY TAG IMAGE ID CREATED SIZE centos 7.9.2009 eeb6ee3f44bd 8 months ago 204MB
PS C:\work> docker create -it --name centos_host centos:7.9.2009 038bea207a8dcc5a6221a56a07478092317e43007889867473a692de38e528a8
PS C:\work> docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 038bea207a8d centos:7.9.2009 "/bin/bash" 3 seconds ago Created centos_host |
| Docker Container start |
|
PS C:\work> docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 038bea207a8d centos:7.9.2009 "/bin/bash" 2 minutes ago Created centos_host
PS C:\work> docker start centos_host centos_host
PS C:\work> docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 038bea207a8d centos:7.9.2009 "/bin/bash" 2 minutes ago Up 2 seconds centos_host |
| Docker Container stop |
|
PS C:\work> docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 038bea207a8d centos:7.9.2009 "/bin/bash" 2 minutes ago Up 17 seconds centos_host
PS C:\work> docker stop centos_host centos_host
PS C:\work> docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 038bea207a8d centos:7.9.2009 "/bin/bash" 2 minutes ago Exited (137) 4 seconds ago centos_host |
| Docker Container commit |
|
PS C:\work> docker images REPOSITORY TAG IMAGE ID CREATED SIZE centos 7.9.2009 eeb6ee3f44bd 8 months ago 204MB
PS C:\work> docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 038bea207a8d centos:7.9.2009 "/bin/bash" 3 minutes ago Exited (137) 32 seconds ago centos_host
PS C:\work> docker commit centos_host centos_container:1 sha256:8d6aa5036037cfde02a03f1481823b93318b053e3582d5edbfb2d25227968fc7
PS C:\work> docker images REPOSITORY TAG IMAGE ID CREATED SIZE centos_container 1 8d6aa5036037 3 seconds ago 204MB centos 7.9.2009 eeb6ee3f44bd 8 months ago 204MB |
| Docker Container rm |
|
PS C:\work> docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 038bea207a8d centos:7.9.2009 "/bin/bash" 3 minutes ago Exited (137) About a minute ago centos_host
PS C:\work> docker rm -f centos_host centos_host
PS C:\work> docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES |
| Docker Image rm |
|
PS C:\work> docker images REPOSITORY TAG IMAGE ID CREATED SIZE centos 7.9.2009 eeb6ee3f44bd 8 months ago 204MB
PS C:\work> docker image rm eeb6ee3f44bd Untagged: centos:7.9.2009 Untagged: centos@sha256:c73f515d06b0fa07bb18d8202035e739a494ce760aa73129f60f4bf2bd22b407 Deleted: sha256:eeb6ee3f44bd0b5103bb561b4c16bcb82328cfe5809ab675bb17ab3a16c517c9 Deleted: sha256:174f5685490326fc0a1c0f5570b8663732189b327007e47ff13d2ca59673db02
PS C:\work> docker images REPOSITORY TAG IMAGE ID CREATED SIZE |
| Docker Container create (pull Skip) |
|
PS C:\work> docker images REPOSITORY TAG IMAGE ID CREATED SIZE
PS C:\work> docker create -it --name centos_host centos:7.9.2009 Unable to find image 'centos:7.9.2009' locally 7.9.2009: Pulling from library/centos 2d473b07cdd5: Pull complete Digest: sha256:c73f515d06b0fa07bb18d8202035e739a494ce760aa73129f60f4bf2bd22b407 Status: Downloaded newer image for centos:7.9.2009 211f2d7ccf87721ced2c62f12c1bfb2e9366954dc4bead84bb979c63a720f8b1
PS C:\work> docker images REPOSITORY TAG IMAGE ID CREATED SIZE centos 7.9.2009 eeb6ee3f44bd 8 months ago 204MB
PS C:\work> docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 211f2d7ccf87 centos:7.9.2009 "/bin/bash" 13 seconds ago Created centos_host |
| Docker Container run (pull/create/start Skip) |
|
PS C:\work> docker images REPOSITORY TAG IMAGE ID CREATED SIZE
PS C:\work> docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
PS C:\work> docker run -itd --name centos_host centos:7.9.2009 Unable to find image 'centos:7.9.2009' locally 7.9.2009: Pulling from library/centos 2d473b07cdd5: Pull complete
Digest: sha256:c73f515d06b0fa07bb18d8202035e739a494ce760aa73129f60f4bf2bd22b407 Status: Downloaded newer image for centos:7.9.2009 0540819b5d6e64203979d5cf3175ae8f281b38a1d8ce8b67660979cbf10b3742
PS C:\work> docker images REPOSITORY TAG IMAGE ID CREATED SIZE centos 7.9.2009 eeb6ee3f44bd 8 months ago 204MB
PS C:\work> docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 0540819b5d6e centos:7.9.2009 "/bin/bash" 16 seconds ago Up 13 seconds centos_host |
참고
Docker Container 명령어
docker run -itd : 표준출력사용/TTY사용/백그라운드 (필수) --name : Container 이름 --cap-add IPC_LOCK Shared Memory 관련 제어를 위한 옵션 (TIBERO 필수) -p 사용할 포트 -v Docker Host와 Container간에 공유할 디렉토리 지정 (Container간 공유 디렉토리 형태로 사용할 수 있음) docker exec -it : 표준출력사용/TTY사용 (필수) ex) Container bash 환경으로 접속을 위해 docker exec -it [container_name] bash docker cp docker cp [소스파일] [container_name]:[경로]
자주 사용 되는 유틸리티가 CentOS 이미지에 설치 되어 있지 않아 Container 배포 후 사전 작업이 필요합니다.
| yum을 통해 설치하거나 파일 업로드하여 설치 |
| yum install -y libaio net-tools wget openssh-clients openssh-server lsof vim sysstat |
Docker for TIBERO
TIBERO는 Docker Hub에 공식으로 등록되있지 않으므로, OS Container 배포 후 설치를 진행합니다.
| CentOS Container run (배포) |
|
PS C:\work> docker run -itd --cap-add IPC_LOCK -p 8629:8629 --name tbContainer centos:7.9.2009 Unable to find image 'centos:7.9.2009' locally 7.9.2009: Pulling from library/centos 2d473b07cdd5: Pull complete Digest: sha256:c73f515d06b0fa07bb18d8202035e739a494ce760aa73129f60f4bf2bd22b407 Status: Downloaded newer image for centos:7.9.2009 b0e9b92ef7f56a94072eb3922e1586f2d0a6a639f5af5754a729d92e8e0d079c
PS C:\work> docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES b0e9b92ef7f5 centos:7.9.2009 "/bin/bash" 14 seconds ago Up 10 seconds 0.0.0.0:8629->8629/tcp tbContainer |
| CentOS Container Access 및 TIBERO 생성 준비 |
|
PS C:\work> docker exec -it tbContainer bash [root@b0e9b92ef7f5 /]# groupadd dba [root@b0e9b92ef7f5 /]# useradd -d /tibero -g dba tibero [root@b0e9b92ef7f5 /]# su - tibero [tibero@b0e9b92ef7f5 ~]$ pwd /tibero |
| CentOS Container TIBERO 설치 파일 복사 (설치 진행은 VM과 동일) |
|
PS C:\work> ls 디렉터리: C:\work Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 2022-01-11 오후 1:27 580 license.xml -a---- 2022-05-13 오전 10:59 1771520 tbinary_v1.4.25.tar -a---- 2022-05-13 오전 10:51 492291264 tibero6-bin-FS07_CS_2005-linux64_3.10-200518-opt-20220216111303_tested.tar.gz
PS C:\work> docker cp .\tibero6-bin-FS07_CS_2005-linux64_3.10-200518-opt-20220216111303_tested.tar.gz tbContainer:/tibero PS C:\work> docker cp .\tbinary_v1.4.25.tar tbContainer:/tibero PS C:\work> docker cp .\license.xml tbContainer:/tibero
PS C:\work> docker exec -it tbContainer bash
[root@b0e9b92ef7f5 /]# cd /tibero
[root@b0e9b92ef7f5 tibero]# ls -rlt total 482492 -rwxr-xr-x 1 root root 580 Jan 11 04:27 license.xml -rwxr-xr-x 1 root root 492291264 May 13 01:51 tibero6-bin-FS07_CS_2005-linux64_3.10-200518-opt-20220216111303_tested.tar.gz -rwxr-xr-x 1 root root 1771520 May 13 01:59 tbinary_v1.4.25.tar
[root@b0e9b92ef7f5 tibero]# chown tibero:dba *
[root@b0e9b92ef7f5 tibero]# ls -rlt total 482492 -rwxr-xr-x 1 tibero dba 580 Jan 11 04:27 license.xml -rwxr-xr-x 1 tibero dba 492291264 May 13 01:51 tibero6-bin-FS07_CS_2005-linux64_3.10-200518-opt-20220216111303_tested.tar.gz -rwxr-xr-x 1 tibero dba 1771520 May 13 01:59 tbinary_v1.4.25.tar
|
| TIBERO 설치 완료 및 확인 |
|
[tibero@b0e9b92ef7f5 ~]$ ps -ef |grep -E "tb" tibero 518 1 0 08:44 pts/2 00:00:00 tbsvr -t NORMAL -SVR_SID tibero tibero 519 518 0 08:44 pts/2 00:00:00 /tibero/tibero6/bin/tblistener -n 11 -t NORMAL -SVR_SID tibero tibero 520 518 0 08:44 pts/2 00:00:00 tbsvr_MGWP -t NORMAL -SVR_SID tibero … 생략
[tibero@b0e9b92ef7f5 ~]$ netstat -nlp |grep -E "8629|8630" tcp 0 0 0.0.0.0:8629 0.0.0.0:* LISTEN 519/tblistener tcp 0 0 0.0.0.0:8630 0.0.0.0:* LISTEN 520/tbsvr_MGWP |
접속 테스트
접속 테스트 IP : localhost / PORT : 8629
| IMS | Content | Error |
| 194811 | docker run --cap-add IPC_LOCK 옵션 추가 |
$ tbcm -b [ERROR] mlock() fail : Cannot allocate memory Tibero cluster manager (cm1) startup failed! |
| 141005 |
$ tbboot nomount cat: /proc/sys/net/core/wmem_max: No such file or directory [0] ***** FATAL ASSERT (PID = 195, TID = 0, SESSID = 0): ***** tbsvr_tracedump.c:278 (tb_svr_assert_cmd): Assertion 'false' failed. ***** Program: tbsvr -startup -t nomount -SVR_SID dodo Segmentation fault (core dumped) |
|
| 256448 |
CM 기동 시 OS Run level 체크하지만 Container는 OS Run level을 제공하지 않아 오류 CMTIP 파라미터 추가 _CM_CHECK_RUNLEVEL=N |
$ cat trace.log OS init runlevel is detected as 0. Retrying to detect... |
Docker for RDBMS
RDBMS 제조사들은 Docker Hub를 RDBMS버전 별로 Container를 제공하고 있어 Docker Hub에서 Container만 내려 받아 바로 사용할 수 있습니다.
Oracle
현재 Docker Hub에서 이미지 제공이 비활성화 되어 있어, 공식 이미지를 제공 받지 못합니다.
비공식 유저들이 업로드한 Docker Image를 활용 (보안 주의)
SQL Server
- 2019년부터 리눅스 버전 제공
Docker Hub Image: https://hub.docker.com/_/microsoft-mssql-server
| docker run 수행으로 Docker hub에서 공식 이미지를 통해 배포 |
|
PS C:\work> docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=Tmaxtibero8629" --name sqlContainer -p 1433:1433 -d mcr.microsoft.com/mssql/server:2022-latest Unable to find image 'mcr.microsoft.com/mssql/server:2022-latest' locally 2022-latest: Pulling from mssql/server d5fd17ec1767: Pull complete 223d0d87c158: Pull complete dbdde79cee40: Pull complete 3644101ecaf8: Pull complete de9d020b44f4: Pull complete Digest: sha256:85495b6c68b58a81a31d37f7e1e1d36384a75baf28bd2b16c77faa5905838126 Status: Downloaded newer image for mcr.microsoft.com/mssql/server:2022-latest cc730aa91b915088ad78e7507604fa8aeef64494ed96b706034e0a4f72482156
PS C:\work> docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES cc730aa91b91 mcr.microsoft.com/mssql/server:2022-latest "/opt/mssql/bin/perm…" 2 seconds ago Up 1 second 0.0.0.0:1433->1433/tcp sqlContainer
|
| docker run 수행으로 Docker hub에서 공식 이미지를 통해 배포 |
|
PS C:\work> docker exec -it sqlContainer bash mssql@cc730aa91b91:/$
mssql@cc730aa91b91:/home$ /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "Tmaxtibero8629" 1> CREATE DATABASE TestDB; 2> go 1> SELECT name FROM sys.databases; 2> go name -------------------------------------------------------------------------------------------------------------------------------- master tempdb model msdb TestDB
1> use testdb 2> go Changed database context to 'TestDB'. 1> CREATE TABLE junsu(x int); 2> go 1> INSERT INTO junsu(x) values(1); 2> go
(1 rows affected) 1> select * FROM junsu; 2> go x ----------- 1
(1 rows affected) 1>
|
PostgreSQL
Docker Hub Image: https://hub.docker.com/_/postgres
| docker run 수행으로 Docker hub에서 공식 이미지를 통해 배포 |
|
PS C:\work> docker run --name pgContainer -p 5432:5432 -e POSTGRES_PASSWORD=Tmaxtibero8629 -d postgres:latest Unable to find image 'postgres:latest' locally latest: Pulling from library/postgres 42c077c10790: Pull complete 3c2843bc3122: Pull complete 12e1d6a2dd60: Pull complete 9ae1101c4068: Pull complete fb05d2fd4701: Pull complete 9785a964a677: Pull complete 16fc798b0e72: Pull complete f1a0bfa2327a: Pull complete fd2d68720749: Pull complete 83b23beac012: Pull complete 7962517582d4: Pull complete 6b4a569b8013: Pull complete ad029fbc8984: Pull complete Digest: sha256:2d1e636f07781d4799b3f2edbff78a0a5494f24c4512cb56a83ebfd0e04ec074 Status: Downloaded newer image for postgres:latest 39645475a75b8052b8f1a5881cc42da265853931a760aa3d31cca5d2605f2c9f
PS C:\work> docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 39645475a75b postgres:latest "docker-entrypoint.s…" 5 seconds ago Up 2 seconds 0.0.0.0:5432->5432/tcp pgContainer |
| docker run 수행으로 Docker hub에서 공식 이미지를 통해 배포 |
|
PS C:\work> docker exec -it pgContainer bash root@39645475a75b:/#
root@39645475a75b:/# apt-get update root@39645475a75b:/# apt-get install -y procps
root@39645475a75b:/# ps -ef UID PID PPID C STIME TTY TIME CMD postgres 1 0 0 01:12 ? 00:00:00 postgres postgres 61 1 0 01:12 ? 00:00:00 postgres: checkpointer postgres 62 1 0 01:12 ? 00:00:00 postgres: background writer postgres 63 1 0 01:12 ? 00:00:00 postgres: walwriter postgres 64 1 0 01:12 ? 00:00:00 postgres: autovacuum launcher postgres 65 1 0 01:12 ? 00:00:00 postgres: stats collector postgres 66 1 0 01:12 ? 00:00:00 postgres: logical replication launcher root 472 0 0 01:14 pts/0 00:00:00 bash root 480 472 0 01:15 pts/0 00:00:00 ps -ef
postgres@39645475a75b:~$ psql -U postgres psql (14.3 (Debian 14.3-1.pgdg110+1)) Type "help" for help.
postgres=# CREATE USER pguser PASSWORD 'tibero' SUPERUSER; CREATE ROLE
postgres=# CREATE DATABASE TestDB OWNER pguser; CREATE DATABASE
postgres=# \c testdb pguser; You are now connected to database "testdb" as user "pguser".
testdb=# CREATE TABLE junsu(x int); CREATE TABLE
testdb=# INSERT INTO junsu(x) VALUES(1); INSERT 0 1
testdb=# COMMIT; WARNING: there is no transaction in progress COMMIT |
MySQL
Docker Hub Image: https://hub.docker.com/_/mysql
| docker run 수행으로 Docker hub에서 공식 이미지를 통해 배포 |
|
PS C:\work> docker run -itd --name myContainer -p 3306:3306 -e MYSQL_ROOT_PASSWORD=Tmaxtibero8629 mysql:latest Unable to find image 'mysql:latest' locally latest: Pulling from library/mysql c1ad9731b2c7: Pull complete 54f6eb0ee84d: Pull complete cffcf8691bc5: Pull complete 89a783b5ac8a: Pull complete 6a8393c7be5f: Pull complete af768d0b181e: Pull complete 810d6aaaf54a: Pull complete 2e014a8ae4c9: Pull complete a821425a3341: Pull complete 3a10c2652132: Pull complete 4419638feac4: Pull complete 681aeed97dfe: Pull complete Digest: sha256:548da4c67fd8a71908f17c308b8ddb098acf5191d3d7694e56801c6a8b2072cc Status: Downloaded newer image for mysql:latest 0c86a10f77e7fc6e505a0c94915bba3e3c983c372626b48e64badd338836cc54
PS C:\work> docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 0c86a10f77e7 mysql:latest "docker-entrypoint.s…" 26 seconds ago Up 20 seconds 0.0.0.0:3306->3306/tcp, 33060/tcp myContainer
|
| docker run 수행으로 Docker hub에서 공식 이미지를 통해 배포 |
|
PS C:\work> docker exec -it myContainer bash root@0c86a10f77e7:/#
root@0c86a10f77e7:/# apt-get update && apt-get install -y procps
root@0c86a10f77e7:/# ps -ef UID PID PPID C STIME TTY TIME CMD mysql 1 0 0 01:34 pts/0 00:00:00 mysqld root 205 0 0 01:36 pts/1 00:00:00 bash root 549 205 0 01:37 pts/1 00:00:00 ps -ef
root@0c86a10f77e7:/# su - mysql su: warning: cannot change directory to /home/mysql: No such file or directory
$ bash
mysql@0c86a10f77e7:/$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 9 Server version: 8.0.29 MySQL Community Server - GPL
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 4 rows in set (0.01 sec)
mysql> CREATE DATABASE TestDB; Query OK, 1 row affected (0.02 sec)
mysql> USE TestDB; Database changed mysql> CREATE TABLE junsu(x int); Query OK, 0 rows affected (0.08 sec)
mysql> INSERT INTO junsu(x) VALUES(1); Query OK, 1 row affected (0.01 sec)
mysql> COMMIT; Query OK, 0 rows affected (0.00 sec)
|
MariaDB
Docker Hub Image: https://hub.docker.com/_/mariadb
| docker run 수행으로 Docker hub에서 공식 이미지를 통해 배포 |
|
PS C:\work> docker run -itd --name mariContainer --env MARIADB_USER=mariuser --env MARIADB_PASSWORD=Tmaxtibero8629 --env MARIADB_ROOT_PASSWORD=Tmaxtibero8629 mariadb:latest Unable to find image 'mariadb:latest' locally latest: Pulling from library/mariadb 405f018f9d1d: Pull complete 7a85079b8234: Pull complete 579c7ff691b1: Pull complete 4976663b5d6d: Pull complete 169024b1fb13: Pull complete c0ffe8ce897f: Pull complete b583c09d23c3: Pull complete 9b9f0c08d08f: Pull complete 9cd51f984586: Pull complete d9f506bb8aca: Pull complete 24d689f79ba4: Pull complete Digest: sha256:88fcb7d92c7f61cd885c4d309c98461f3607aa6dbd57a2474be86e1956b36d13 Status: Downloaded newer image for mariadb:latest 97396f4af27305699c144d53741fcfa7d031dd5ea33b7813bfebb04cfa41c794
PS C:\work> docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 97396f4af273 mariadb:latest "docker-entrypoint.s…" 15 seconds ago Up 12 seconds 3306/tcp mariContainer |
| docker run 수행으로 Docker hub에서 공식 이미지를 통해 배포 |
|
PS C:\work> docker exec -it mariContainer bash root@97396f4af273:/# su - ^C root@97396f4af273:/# ps PID TTY TIME CMD 163 pts/1 00:00:00 bash 172 pts/1 00:00:00 ps
root@97396f4af273:/# su - mysql su: warning: cannot change directory to /home/mysql: No such file or directory $ bash mysql@97396f4af273:/$
mysql@97396f4af273:/$ mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 7 Server version: 10.8.3-MariaDB-1:10.8.3+maria~jammy mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> CREATE DATABASE TestDB; Query OK, 1 row affected (0.000 sec)
MariaDB [(none)]> USE TestDB; Database changed MariaDB [TestDB]> CREATE TABLE junsu(x int); Query OK, 0 rows affected (0.048 sec)
MariaDB [TestDB]> INSERT INTO junsu(x) VALUES(1); Query OK, 1 row affected (0.004 sec)
MariaDB [TestDB]> COMMIT; Query OK, 0 rows affected (0.000 sec)
MariaDB [TestDB]> quit Bye
|
※ MariaDB, MySQL 같이 사용하는 경우
| MariaDB Container 배포 후 하기와 같이 PORT 변경 |
|
PS C:\work> docker exec -it mariContainer bash
root@29ca1648b370:/etc/mysql/mariadb.conf.d# cd /etc/mysql/mariadb.conf.d
root@29ca1648b370:/etc/mysql/mariadb.conf.d# vi 50-server.cnf ... 생략 ... [mariadb] port=3316 root@29ca1648b370:/etc/mysql/mariadb.conf.d# exit
PS C:\work> docker restart mariContainer mariContainer |
DB2
Docker Hub Image : https://hub.docker.com/r/ibmcom/db2
| docker run 수행으로 Docker hub에서 공식 이미지를 통해 배포 |
|
PS C:\work> docker run -itd --name db2Container --privileged=true -p 50000:50000 -e LICENSE=accept -e DB2INST1_PASSWORD=Tmaxtibero8629 -e DBNAME=testdb ibmcom/db2 Unable to find image 'ibmcom/db2:latest' locally latest: Pulling from ibmcom/db2 8dfe9326f733: Pull complete 0d875a68bf99: Pull complete 50e8fb20327b: Pull complete a0c05fd037e6: Pull complete 1cd5cf0a05ba: Pull complete 6c97ca72f52c: Pull complete e0c22e12ea4e: Pull complete 06fa0bd3b2ef: Pull complete 01d61e0e2f08: Pull complete 849d15abca93: Pull complete be6ee447107f: Pull complete 408a6e6d33a2: Pull complete a9c177505816: Pull complete Digest: sha256:81d01c71ed0d1ae27ee51ab53133610970b25b60de385a0c1906fe53017f4c96 Status: Downloaded newer image for ibmcom/db2:latest 46aa66c3ad13fb1f1330f8cfb2fecfab92c1e85a1d3e5d420d316a659bdf6bce
PS C:\work> docker exec -it db2Container bash [root@46aa66c3ad13 /]# ps -ef UID PID PPID C STIME TTY TIME CMD root 1 0 0 03:29 pts/0 00:00:00 /bin/bash /var/db2_setup/lib/setup_db2_instance.sh root 14155 0 0 03:31 pts/1 00:00:00 bash root 15669 1 0 03:31 ? 00:00:00 db2wdog 0 [db2inst1] db2inst1 15671 15669 0 03:31 ? 00:00:00 db2sysc 0 root 15677 15669 0 03:31 ? 00:00:00 db2ckpwd 0 root 15678 15669 0 03:31 ? 00:00:00 db2ckpwd 0 root 15679 15669 0 03:31 ? 00:00:00 db2ckpwd 0 db2inst1 15681 15669 0 03:31 ? 00:00:00 db2vend (PD Vendor Process - 1) 0 db2inst1 15690 15669 0 03:31 ? 00:00:00 db2acd 0 ,0,0,0,1,0,0,00000000,0,0,0000000000000000,0000000000000000,00000000,00000000,00000000,00000000,00000000,00000000,0008,000000ff,00000000,00000000,00000000,00000000,00000000,0000000 root 16229 1 0 03:31 ? 00:00:00 /usr/bin/python3 /usr/bin/supervisord -c /etc/supervisord.conf root 16233 1 0 03:31 pts/0 00:00:00 /usr/bin/coreutils --coreutils-prog-shebang=tail /usr/bin/tail -/database/config/db2inst1/sqllib/db2dump/DIAG0000/db2diag.log root 16234 16229 0 03:31 ? 00:00:00 bash -c /var/db2_setup/lib/backup_cfg.sh >> /tmp/backup_cfg.out 2>&1 root 16235 16229 0 03:31 ? 00:00:00 /opt/ibm/db2/V11.5/bin/db2fmcd root 16237 16234 0 03:31 ? 00:00:00 /bin/bash /var/db2_setup/lib/backup_cfg.sh root 16242 16229 0 03:31 ? 00:00:00 /usr/sbin/sshd -D root 16400 16237 0 03:31 ? 00:00:00 /usr/bin/coreutils --coreutils-prog-shebang=sleep /usr/bin/sleep 2m root 16683 16229 0 03:33 ? 00:00:00 /bin/bash /var/db2_setup/lib/fix_etc_host.sh root 16715 16683 0 03:33 ? 00:00:00 /usr/bin/coreutils --coreutils-prog-shebang=sleep /usr/bin/sleep 10 root 16721 0 2 03:33 pts/2 00:00:00 bash root 16735 16721 0 03:33 pts/2 00:00:00 ps -ef
PS C:\work> docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 46aa66c3ad13 ibmcom/db2 "/var/db2_setup/lib/…" 5 minutes ago Up 4 minutes 22/tcp, 55000/tcp, 60006-60007/tcp, 0.0.0.0:50000->50000/tcp db2Container [db2inst1@46aa66c3ad13 ~]$ db2 "SELECT * FROM department;" SQL0204N "DB2INST1.DEPARTMENT" is an undefined name. SQLSTATE=42704 [db2inst1@46aa66c3ad13 ~]$ db2 (c) Copyright IBM Corporation 1993,2007 Command Line Processor for DB2 Client 11.5.7.0
You can issue database manager commands and SQL statements from the command prompt. For example: db2 => connect to sample db2 => bind sample.bnd
For general help, type: ?. For command help, type: ? command, where command can be the first few keywords of a database manager command. For example: ? CATALOG DATABASE for help on the CATALOG DATABASE command ? CATALOG for help on all of the CATALOG commands.
To exit db2 interactive mode, type QUIT at the command prompt. Outside interactive mode, all commands must be prefixed with 'db2'. To list the current command option settings, type LIST COMMAND OPTIONS.
For more detailed help, refer to the Online Reference Manual.
db2 => connect to testdb
Database Connection Information
Database server = DB2/LINUXX8664 11.5.7.0 SQL authorization ID = DB2INST1 Local database alias = TESTDB
db2 => create table junsu(x int); DB20000I The SQL command completed successfully. db2 => insert into junsu(x) values(1); DB20000I The SQL command completed successfully.
db2 => commit; DB20000I The SQL command completed successfully. db2 => select * FROM jusnu; SQL0204N "DB2INST1.JUSNU" is an undefined name. SQLSTATE=42704 db2 => select * FROM junsu;
X ----------- 1 1 record(s) selected. |