1.拉取Oracle镜像

1
# docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
2
3
# docker images
4
registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g                          latest             3fa112fd3642        4 years ago         6.85GB

2.创建容器

1
# docker run -d -p 1521:1521 --name oracle11g registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g

3.启动容器

1
# docker start oracle11g

4.进入镜像配置

1
# docker exec -it oracle11g bash
  • 软连接

    1
    $ sqlplus /nolog
  • 切换到root

    1
    # su - root #密码:helowin
  • 配置oracle环境变量

    1
    vi /etc/profile
    2
    3
    # 追加如下内容
    4
    export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2
    5
    export ORACLE_SID=helowin
    6
    export PATH=$ORACLE_HOME/bin:$PATH
  • 创建软连接

    1
    # ln -s $ORACLE_HOME/bin/sqlplus /usr/bin
    2
    # su - oracle
  • 登录sqlplus并修改sys、system用户密码

    1
    $ sqlplus /nolog
    2
    3
    > conn /as sysdba

    执行命令

    1
    > alter user system identified by system;
    2
    > alter user sys identified by sys;
    3
    创建用户
    4
    > create user test identified by test;
    5
    > grant connect,resource,dba to test;