内容简介:How-to run Oracle 12.2 with docker on Ubuntu
前言
昨天有一位搞 DBA 同学问我会不会用 Docker。Ta 想要在上面跑一个 Oracle 实例。整个过程非常流畅,写篇文章备用。 :)
ENV
# lsb_release -a Distributor ID: Ubuntu Description: Ubuntu 16.04.2 LTS Release: 16.04 Codename: xenial # Oracle Version Package linuxx64_12201_database.zip
Install docker
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list apt-get update apt-get install docker-engine -y
Download Oracle Docker Image
Docker Images from Oracle https://github.com/oracle/docker-images
cd ~ git clone git@github.com:oracle/docker-images.git oracle-images
Download & Upload Oracle
Download page http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html
when you download the package, upload it to the ${docker-images}/OracleDatabase/dockerfiles/x.x.x.x/
du -sh ./oracle-images/OracleDatabase/dockerfiles/12.2.0.1/* | grep zip 3.3G ./oracle-images/OracleDatabase/dockerfiles/12.2.0.1/linuxx64_12201_database.zip
接下来,开始无脑安装。因为有一些依赖包需要安装,请确保 REPO & 网络可用。
Build Docker Image
# bash oracle-images/OracleDatabase/dockerfiles/buildDockerImage.sh -v 12.2.0.1 -e # bash oracle-images/OracleDatabase/dockerfiles/buildDockerImage.sh Usage: buildDockerImage.sh -v [version] [-e | -s | -x] [-i] Builds a Docker Image for Oracle Database. Parameters: -v: version to build Choose one of: oracle-images -e: creates image based on 'Enterprise Edition' -s: creates image based on 'Standard Edition 2' -x: creates image based on 'Express Edition' -i: ignores the MD5 checksums * select one edition only: -e, -s, or -x LICENSE CDDL 1.0 + GPL 2.0 Copyright (c) 2014-2017 Oracle and/or its affiliates. All rights reserved.
整个过程分16步自动完成,具体完成时间取决于系统环境配置。
成功的日志类似如下的:
Oracle Database Docker Image for 'ee' version 12.2.0.1 is ready to be extended: --> oracle/database:12.2.0.1-ee build completed in 50235 second
Check Image
$sudo docker images REPOSITORY TAG IMAGE ID CREATED SIZE oracle/database 12.2.0.1-ee 2b8746d2b5a0 23 hours ago 14.8GB oraclelinux 7-slim 0b44f4e6980d 13 days ago 114MB
Run Oracle
docker run --name oracle -p 1521:1521 -p 5500:5500 -v /opt/oracle/oradata:/opt/oracle/oradata oracle/database:12.2.0.1-ee ########################################## docker run --name <container name> \ -p <host port>:1521 -p <host port>:5500 \ -e ORACLE_SID=<your SID> \ -e ORACLE_PDB=<your PDB name> \ -e ORACLE_PWD=<your database passwords> \ -e ORACLE_CHARACTERSET=<your character set> \ -v [<host mount point>:]/opt/oracle/oradata \ oracle/database:12.2.0.1-ee Parameters: --name: The name of the container (default: auto generated) -p: The port mapping of the host port to the container port. Two ports are exposed: 1521 (Oracle Listener), 5500 (OEM Express) -e ORACLE_SID: The Oracle Database SID that should be used (default: ORCLCDB) -e ORACLE_PDB: The Oracle Database PDB name that should be used (default: ORCLPDB1) -e ORACLE_PWD: The Oracle Database SYS, SYSTEM and PDB_ADMIN password (default: auto generated) -e ORACLE_CHARACTERSET: The character set to use when creating the database (default: AL32UTF8) -v The data volume to use for the database. Has to be owned by the Unix user "oracle" or set appropriately. If omitted the database will not be persisted over container recreation.
Changing the admin accounts passwords
# ./OracleDatabase/dockerfiles/12.2.0.1/setPassword.sh docker exec <container name> ./setPassword.sh <your password>
更多信息 详见 https://github.com/oracle/docker-images/tree/master/OracleDatabase
$sudo docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES aba4fc65f3e7 oracle/database:12.2.0.1-ee "/bin/sh -c 'exec ..." 7 hours ago Up 2 hours 0.0.0.0:1521->1521/tcp, 0.0.0.0:5500->5500/tcp oracle
Oracle SQL Developer Test
至此,一个基于 Docker 的简单测试环境构建完成。
~ EOF ~
Reference
[0] https://github.com/oracle/docker-images
[1] https://github.com/oracle/docker-images/tree/master/OracleDatabase
以上所述就是小编给大家介绍的《How-to run Oracle 12.2 with docker on Ubuntu》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Unity 3D游戏开发(第2版)
宣雨松 / 人民邮电出版社 / 2018-9 / 89.00元
Unity 是一款市场占有率非常高的商业游戏引擎,横跨25 个主流游戏平台。本书基于Unity 2018,结合2D 游戏开发和3D 游戏开发的案例,详细介绍了它的方方面面,内容涉及编辑器、游戏脚本、UGUI 游戏界面、动画系统、持久化数据、静态对象、多媒体、资源加载与优化、自动化与打包等。 本书适合初学者或者有一定基础的开发者阅读。一起来看看 《Unity 3D游戏开发(第2版)》 这本书的介绍吧!