拉取镜像
docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
启动一个临时容器,作为抽取 /home/oracle/app作为初始化数据
docker run -di --name test --restart unless-stopped \
-p 1521:1521 registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
mkdir -p /docker/oracle
docker cp test:/home/oracle/app/ /docker/oracle
cd /docker/oracle
chown -R 500.500 app
docker rm -f test
启动正式容器
docker run -d --name oracle --restart unless-stopped -v /docker/oracle/app:/home/oracle/app -p 1521:1521 registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
初始化数据库
docker exec -it oracle /bin/bash
cd /home/oracle/
source .bash_profile
rm -rf /home/oracle/app/oracle/flash_recovery_area/helowin/control02.ctl
cp /home/oracle/app/oracle/oradata/helowin/control01.ctl /home/oracle/app/oracle/flash_recovery_area/helowin/control02.ctl
sqlplus / as sysdba
shutdown immediate
startup
alter user system identified by oracle;
alter user sys identified by oracle;
alter profile default limit password_life_time unlimited;