原 在Docker中分分钟拥有达梦数据库
Tags: 原创Docker安装部署达梦数据库数据库Docker镜像DM8
一、从Docker Hub或阿里云镜像下载小麦苗上传的镜像文件
- 小麦苗的Docker Hub的地址:https://hub.docker.com/u/lhrbest
- 达梦8数据库的地址:https://hub.docker.com/r/lhrbest/lhrdm8/tags
1 2 | docker pull registry.cn-hangzhou.aliyuncs.com/lhrbest/lhrdm8:20220709 docker tag docker pull registry.cn-hangzhou.aliyuncs.com/lhrbest/lhrdm8:20220709 lhrbest/lhrdm8:20220709 |
二、创建容器并启动数据库
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # 1、创建容器 docker rm -f lhrdm8 docker run -d --name lhrdm8 -h lhrdm8 \ -p 52360-52364:5236-5240 -p 58080:8080 -p 53389:3389 \ -v /sys/fs/cgroup:/sys/fs/cgroup \ --privileged=true lhrbest/lhrdm8:20220709 \ /usr/sbin/init -- 注意:这里的20220709表示2022年7月9日过期 # 2、进入容器 docker exec -it lhrdm8 bash # 3、检查服务 systemctl status DmAgentService DmAPService DmServiceDMSERVER tomcat | grep Active |
执行过程如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | [root@docker36 ~]# docker pull registry.cn-hangzhou.aliyuncs.com/lhrbest/lhrdm8:20220709 20220709: Pulling from lhrbest/lhrdm8 6c9bd523761a: Already exists ca2653ae8bb5: Pull complete 47212209580b: Pull complete Digest: sha256:acccbfa68ee6fcb0cb3befcad946a78b7ffdcfdefccb8037465d56d41ae8c50f Status: Downloaded newer image for registry.cn-hangzhou.aliyuncs.com/lhrbest/lhrdm8:20220709 registry.cn-hangzhou.aliyuncs.com/lhrbest/lhrdm8:20220709 [root@docker36 ~]# docker tag registry.cn-hangzhou.aliyuncs.com/lhrbest/lhrdm8:20220709 lhrbest/lhrdm8:20220709 [root@docker36 ~]# [root@docker36 ~]# docker rm -f lhrdm8 Error: No such container: lhrdm8 [root@docker36 ~]# docker run -d --name lhrdm8 -h lhrdm8 \ > -p 52360-52364:5236-5240 -p 58080:8080 -p 53389:3389 \ > -v /sys/fs/cgroup:/sys/fs/cgroup \ > --privileged=true lhrbest/lhrdm8:20220709 \ > /usr/sbin/init 141bcd3255b985dbd2869bbaec4a1700db1dd8ba54fb0cf2e9595b2da2bddd0e [root@docker36 ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 141bcd3255b9 lhrbest/lhrdm8:20220709 "/usr/sbin/init" 5 minutes ago Up 5 minutes 0.0.0.0:53389->3389/tcp, 0.0.0.0:52360->5236/tcp, 0.0.0.0:52361->5237/tcp, 0.0.0.0:52362->5238/tcp, 0.0.0.0:52363->5239/tcp, 0.0.0.0:52364->5240/tcp, 0.0.0.0:58080->8080/tcp lhrdm8 [root@docker36 ~]# docker exec -it lhrdm8 bash [root@lhrdm8 /]# [root@lhrdm8 /]# [root@lhrdm8 /]# systemctl status DmAgentService DmAPService DmServiceDMSERVER tomcat | grep Active Active: active (running) since Thu 2021-10-21 15:07:24 CST; 1h 29min ago Active: active (running) since Thu 2021-10-21 15:07:32 CST; 1h 29min ago Active: active (running) since Thu 2021-10-21 16:36:49 CST; 8s ago Active: active (running) since Thu 2021-10-21 15:07:17 CST; 1h 29min ago |
三、尽情使用吧
3.1 数据库使用
1 2 3 4 5 6 7 8 9 10 11 12 | [root@lhrdm8 /]# disql SYSDBA/SYSDBA Server[LOCALHOST:5236]:mode is normal, state is open login used time : 2.862(ms) disql V8 SQL> select * from v$database; LINEID NAME CREATE_TIME ARCH_MODE LAST_CKPT_TIME STATUS$ ROLE$ MAX_SIZE TOTAL_SIZE DSC_NODES OPEN_COUNT STARTUP_COUNT LAST_STARTUP_TIME ---------- ------ ------------------- --------- -------------- ----------- ----------- -------------------- -------------------- ----------- ----------- -------------------- ------------------- 1 DAMENG 2021-10-15 10:26:55 Y NULL 4 0 0 60416 1 6 5 2021-10-21 16:36:34 used time: 3.879(ms). Execute id is 1200. |
3.2 DEM的使用
有关DEM的更多内容参考:https://www.dbaup.com/dameng8zhidemanzhuangshiyong.html
这个镜像默认配置了DEM,端口为8080,主机映射端口为58080,所以DEM的访问地址为:http://192.168.66.35:58080/dem/
用户名为admin,密码为888888