Focus On Oracle

Installing, Backup & Recovery, Performance Tuning,
Troubleshooting, Upgrading, Patching, Zero-Downtime Upgrade, GoldenGate

Oracle Exadata ,Oracle ODA, Oracle ZDLRA


当前位置: 首页 » 技术文章 » Cloud

Install oracle products on docker

现在我们可以从oracle的container registry中下载pre-installed/pre-built image来进行安装。安装非常简单,大大简化了工作量。预制的image包括k8s,Oracle的数据库(标准版、企业版、单实例、集群)、中间件(BI、weblogic、coherence、tuxedo、soa、webtier、odi、fmw)、操作系统、Java、MySQL(社区办、企业版)等等。本部描述的是在Oracle7上安装docker,然后部署MySQL企业版的一个用例。

Oracle container regisry的地址

https://container-registry.oracle.com/pls/apex/f?p=113:10

首先在Oracle7上安装docker
[root@xd07dbm01 ~]# cd /etc/yum.repos.d/
[root@xd07dbm01 ~]# wget http://yum.oracle.com/public-yum-ol7.repo
[root@xd07dbm01 ~]# vi public-yum-ol7.repo
[ol7_latest]
name=Oracle Linux $releasever Latest ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/latest/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1

[ol7_UEKR4]
name=Latest Unbreakable Enterprise Kernel Release 4 for Oracle Linux $releasever ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/UEKR4/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1

[ol7_addons]
name=Oracle Linux $releasever Add ons ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/addons/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1

[root@xd07dbm01 ~]# yum install docker-engine -y
[root@xd07dbm01 ~]# systemctl start docker
[root@xd07dbm01 ~]# systemctl enable docker

[root@xd07dbm01 ~]# systemctl status docker


用账号登录Oracle的container registry,并下载相关镜像
[root@xd07dbm01 ~]# docker login container-registry.oracle.com
Username: chaoyang.han@oracle.com
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@xd07dbm01 ~]#

[root@xd07dbm01 ~]# docker pull container-registry.oracle.com/mysql/enterprise-server:8.0.13
Trying to pull repository container-registry.oracle.com/mysql/enterprise-server ...
8.0.13: Pulling from container-registry.oracle.com/mysql/enterprise-server
e64f6e679e1a: Pull complete
d4d26fca1610: Pull complete
a60f010bde70: Pull complete
c2786cb6b8dc: Pull complete
Digest: sha256:5018d61b5adfb1a6d277f1868c159455b96fae22f8d1450a576c1a3aca14f728
Status: Downloaded newer image for container-registry.oracle.com/mysql/enterprise-server:8.0.13
[root@xd07dbm01 ~]#
[root@xd07dbm01 ~]# docker images
REPOSITORY                                              TAG                 IMAGE ID            CREATED             SIZE
container-registry.oracle.com/mysql/enterprise-server   8.0.13              26982f72913d        4 months ago        317MB

[root@xd07dbm01 ~]#


下面是在docker中如何运行MySQL8.0.13企业版的日志
docker run --name=mysqla -d container-registry.oracle.com/mysql/enterprise-server:8.0.13
docker ps
docker logs mysqla 2>&1 | grep GENERATED
docker exec -it mysql1 mysql -uroot -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'oracle';
docker exec -it mysqla bash
ls /var/lib/mysql
docker stop mysqla
docker rm mysqla

[root@xd07dbm01 ~]# docker run --name=mysqla -d container-registry.oracle.com/mysql/enterprise-server:8.0.13
57dd0006ec504a3adf6695ef305325d0c697efa30e3670f5cffce84c68080311
[root@xd07dbm01 ~]# docker logs mysqla 2>&1 | grep GENERATED
[Entrypoint] GENERATED ROOT PASSWORD: 0Px0L&@z0z4m*oLw3k7ux4L.3p9
[root@xd07dbm01 ~]# docker exec -it mysqla mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.13-commercial

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

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> ALTER USER 'root'@'localhost' IDENTIFIED BY 'oracle';
Query OK, 0 rows affected (0.04 sec)

mysql> exit
Bye
[root@xd07dbm01 ~]# docker exec -it mysqla bash
bash-4.2#
exit
[root@xd07dbm01 ~]# docker stop mysqla
mysqla
[root@xd07dbm01 ~]#

其他有用的docker工具,比如Docker Toolbox(包含boot2docker,kitematic),不是Docker for windows

https://docs.docker.com/toolbox/toolbox_install_windows/

https://download.docker.com/win/stable/DockerToolbox.exe

https://github.com/boot2docker
https://docs.docker.com/toolbox/
https://kitematic.com/
https://github.com/docker/kitematic



Reference
https://blogs.oracle.com/virtualization/install-docker-on-oracle-linux-7-v2
https://dev.mysql.com/doc/refman/8.0/en/docker-mysql-getting-started.html

https://container-registry.oracle.com/pls/apex/f?p=113:10

https://hub.docker.com/_/oraclelinux/


关键词:docker mysql linux oracle 

相关文章

Oracle Database 23ai初体验
Oracle GoldenGate 23ai for Oracle和PG发布了
Oracle 23ai发布了
Oracle宣布推出全球分布式自治数据库
Oracle 23c新特性---开发人员
Oracle 23c free FAQ
Oracle 23c free and OCI Base Service
Oracle 21c
基于PDB的Active Data Guard(Oracle 21.7+)
在Oracle数据库中使用REST
OGG from MySQL to Oracle
MySQL数据库高可用实践
Top