Docker 云镜像加速设置
1、注册阿里云容器加速服务(免费)https://cr.console.aliyun.com/
2、获取加速器地址
3、docker配置
{
"experimental": false,
"debug": true,
"registry-mirrors": [
"https://registry.docker-cn.com",
"https://*****.mirror.aliyuncs.com"
]
}
4、重启docker
5、docker搜索远程仓库oracle镜像
docker search oracle
搜索结果
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
oraclelinux Official Docker builds of Oracle Linux. 720 [OK]
jaspeen/oracle-11g Docker image for Oracle 11g database 168 [OK]
oracleinanutshell/oracle-xe-11g 134
wnameless/oracle-xe-11g-r2 Oracle Express Edition 11g Release 2 on Ubun… 54
absolutapps/oracle-12c-ee Oracle 12c EE image with web management cons… 45
araczkowski/oracle-apex-ords Oracle Express Edition 11g Release 2 on Ubun… 30 [OK]
truevoly/oracle-12c Copy of sath89/oracle-12c image (https://git… 27
bofm/oracle12c Docker image for Oracle Database 24 [OK]
quillbuilduser/oracle-18-xe Oracle 18c XE Image for Quill Testing Purpos… 20
datagrip/oracle Oracle 11.2 & 12.1.0.2-se2 & 11.2.0.2-xe 19 [OK]
6、下载对应的镜像,我这里选择的是truevoly/oracle-12c
docker pull truevoly/oracle-12c
7、安装完毕,查看已安装的镜像
docker images
查询结果
REPOSITORY TAG IMAGE ID CREATED SIZE
truevoly/oracle-12c latest 21789d4d876f 24 months ago 5.7GB
8、创建容器
#创建到当前用户目录下了,可以修改
mkdir -p develpoment/oracle12c/data
docker run --name oracle12c -d -p 8080:8080 -p 1521:1521 -v development/oracle/data:/u01/app/oracle truevoly/oracle-12c
- h “oracle”:指定容器的 hostname 为 oracle
- name “oracle”:将容器命名为 oracle
- d:在后台运行
- p: 端口映射,格式为:主机(宿主)端口:容器端口
通过docker ps -a可以查看容器创建状态
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
bdec402d965b truevoly/oracle-12c "/entrypoint.sh " 37 minutes ago Up 37 minutes 0.0.0.0:1521->1521/tcp, 0.0.0.0:8088->8080/tcp oracle12c
88328a77f5f0 registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g "/bin/sh -c '/home/o…" 17 hours ago Exited (137) 53 minutes ago oracle_11g
9、查看容器启动日志
#oracle12c 为容器名或id
docker logs -f oracle12c
aleldragon@Dragon ~ % docker logs -f oracle12c
Database not initialized. Initializing database.
Starting tnslsnr
Copying database files
1% complete
3% complete
11% complete
18% complete
26% 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':
ls: cannot access /docker-entrypoint-initdb.d/*: No such file or directory
Import finished
Database ready to use. Enjoy! ;)
Database ready to use. Enjoy! ;)表示数据库创建成功
10、使用root用户连接容器oracle12c 或容器id bdec402d965b
docker exec -it -u root oracle12c bash
11、登录oracle 使用默认用户测试 用户名/密码
sqlplus system/oracle
oot@bdec402d965b:/# sqlplus system/oracle
SQL*Plus: Release 12.1.0.2.0 Production on Fri Jan 29 08:00:11 2021
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Standard Edition Release 12.1.0.2.0 - 64bit Production
SQL>
13、未安装sqlplus 的brow安装
# install on MacOS
brew tap InstantClientTap/instantclient
cp ~/Download/instantclient*.zip /usr/local/Homebrew/Library/Taps/instantclienttap/homebrew-instantclient
brew install instantclient-basic
brew install instantclient-sqlplus
brew install instantclient-tools
14、使用Navicat连接数据库
连接名:自定
主机:本机ip地址
端口号:默认1521,可以自定
服务器名:xe
默认用户名密码system/oracle