赞
踩
首先在Ubuntu16.04安装好Docker软件,然后开始搜索Oracle的镜像。这里我们可以使用search命令搜索。可以发现在docker的镜像里面搜索到sath89创建的Oracle镜像。
postgres@postgres-N65S01:~$ sudo docker search oracle
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
oraclelinux Official Docker builds of Oracle Linux. 446 [OK]
frolvlad/alpine-oraclejdk8 The smallest Docker image with OracleJDK 8 (… 301 [OK]
sath89/oracle-12c Oracle Standard Edition 12c Release 1 with d… 288 [OK]
alexeiled/docker-oracle-xe-11g This is a working (hopefully) Oracle XE 11.2… 249 [OK]
sath89/oracle-xe-11g Oracle xe 11g with database files mount supp… 178 [OK]
isuper/java-oracle This repository contains all java releases f… 55 [OK]
wnameless/oracle-xe-11g Dockerfile of Oracle Database Express Editio… 51 [OK]
oracle/glassfish GlassFish Java EE Application Server on Orac… 42 [OK]
oracle/openjdk Docker images containing OpenJDK Oracle Linux 37 [OK]
airdock/oracle-jdk Docker Image for Oracle Java SDK (8 and 7) b… 30 [OK]
ingensi/oracle-jdk Official Oracle JDK installed on centos. 21 [OK]
cogniteev/oracle-java Oracle JDK 6, 7, 8, and 9 based on Ubuntu 16… 20 [OK]
n3ziniuka5/ubuntu-oracle-jdk Ubuntu with Oracle JDK. Check tags for versi… 16 [OK]
oracle/nosql Oracle NoSQL on a Docker Image with Oracle L… 15 [OK]
sgrio/java-oracle Docker images of Java 7/8/9 provided by Orac… 11 [OK]
collinestes/docker-node-oracle A container with Node.js/Oracle instant clie… 10 [OK]
openweb/oracle-tomcat A fork off of Official tomcat image with Ora… 7 [OK]
andreptb/oracle-java Debian Jessie based image with Oracle JDK in… 7 [OK]
flurdy/oracle-java7 Base image containing Oracle's Java 7 JDK 5 [OK]
martinseeler/oracle-server-jre Oracle's Java 8 as 61 MB Docker container. 4 [OK]
davidcaste/debian-oracle-java Oracle Java 8 (and 7) over Debian Jessie 3 [OK]
teradatalabs/centos6-java8-oracle Docker image of CentOS 6 with Oracle JDK 8 i… 3
spansari/nodejs-oracledb nodejs with oracledb installed globally on o… 2
publicisworldwide/oracle-core This is the core image based on Oracle Linux… 1 [OK]
softwareplant/oracle oracle db 0 [OK]
我们选择拉12c数据库镜像
postgres@postgres-N65S01:~$ sudo docker pull sath89/oracle-12c
Using default tag: latest
latest: Pulling from sath89/oracle-12c
863735b9fd15: Pull complete
4fbaa2f403df: Pull complete
44be94a95984: Pull complete
a3ed95caeb02: Pull complete
b8bc6e8767ee: Pull complete
c918da326197: Pull complete
448e1619a038: Pull complete
faadd00cf98e: Pull complete
94c8eec9fdf0: Pull complete
58e66654f771: Pull complete
Digest: sha256:a0f6f1cfd3738b0c00f4025a656335b53c205b3bfc0722908ee7b1469111665b
Status: Downloaded newer image for sath89/oracle-12c:latest
镜像有点大,拉完之后查看镜像
postgres@postgres-N65S01:~$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest e38bc07ac18e 3 weeks ago 1.85kB
sath89/oracle-12c latest 17cd1ab9d9a7 4 months ago 5.7GB
接下来创建一个容器,并运行Oracle 12c。这里需要参考网站https://hub.docker.com/r/sath89/oracle-12c/的内容。
运行容器有三种运行方式。
1.直接运行在8080和1521端口
docker run -d -p 8080:8080 -p 1521:1521 sath89/oracle-12c
2.在主机上运行数据并能够重用
docker run -d -p 8080:8080 -p 1521:1521 -v /my/oracle/data:/u01/app/oracle sath89/oracle-12c
3.使用自定于的DBCA_TOTAL_MEMORY运行
docker run -d -p 8080:8080 -p 1521:1521 -v /my/oracle/data:/u01/app/oracle -e DBCA_TOTAL_MEMORY=1024 sath89/oracle-12c
我使用第二种,第二种可以把创建的数据库保存在本地。这里我先创建一个文件夹用于持久保存数据。
sudo mkdir -p /u01/app/oracle
然后运行创建实例和数据库
sudo docker run -d -p 8080:8080 -p 1521:1521 -v /u01/app/oracle:/u01/app/oracle sath89/oracle-12c
81d5d58574c08b0f35fa57e7c1ff1cc06e8f1bcb918d42887de2bee5d83ad119
运行上述命令会有一串字母,这里可以通过这串字母查看创建期间的日志。
docker logs -f 81d5d58574c08b0f35fa57e7c1ff1cc06e8f1bcb918d42887de2bee5d83ad119
Database not initialized. Initializing database.
Starting tnslsnr
Copying database files
1% complete
3% complete
11% complete
18% complete
26% complete
33% complete
37% complete
Creating and starting Oracle instance
40% complete
45% complete
50% complete
55% complete
56% complete
60% complete
62% complete
Completing Database Creation
66% complete
70% complete
73% complete
85% complete
96% complete
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/xe/xe.log" for further details.
Configuring Apex console
Database initialized. Please visit http://#containeer:8080/em http://#containeer:8080/apex for extra configuration if needed
Starting web management console
PL/SQL procedure successfully completed.
Starting import from '/docker-entrypoint-initdb.d':
found file /docker-entrypoint-initdb.d//docker-entrypoint-initdb.d/*
[IMPORT] /entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
Import finished
Database ready to use. Enjoy!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。