您的位置:首页 > 运维架构 > Docker

[Docker] - Install Oracle DB over Docker as development DB

2016-03-26 20:52 876 查看
Because database is just for development usage, I chose Oracle XE, and I found there is a nice image which lots of people have pull and benefited from,

wnameless/oracle-xe-11g,
over 100k people have used it.

Following the steps:

Pull Image from docker repository

> docker pull wnameless/oracle-xe-11g

# show all images in your docker
> docker images

Run image to create container

> docker run —name oracle11g -d -p 9090:8080 -p 2222:22 -p 1521:1521  wnameless/oracle-xe-11g

# name this container oracle11g, later on we can operate this container with this name
# Container’s 8080 port (apex) is mapped to virtual box docker daemon’s 9090
# Container’s 22 port (ssh) is mapped to virtual box docker daemon’s 2222
# Container’s 1521 port (oracle db) is mapped to virtual box docker daemon’s 1521

# check current run containers, oracle11g should be right over here
> docker ps

The container, oralce11g, has been created. After this if you would like to start oracle db what you only need to do is to start the container.

Stop container

# stop container oracle11g
> docker stop oracle11g

> docker ps
# now oracle11g is not running, so it should not be displayed here.

# show all containers including not running ones, oracle11g should be here
> docker ps -a


Start container

# start container by container name
> docker start oracle11g


Find IP address of docker daemon (virtualbox docker vm)

docker-machine ls


It's 192.168.99.100 on my computer.

Basic info of container vm and oracle db

Oracle 11g XE
VM: 192.168.99.100
port: 1521
sid: xe
username: system and sys
password: oracle

oracle11g container VM
username: root
password: admin

You can su user oracle from root.


SSH connect to VM

ssh root@192.168.99.100 -p 2222

SQLDeveloper connect to DB



Enable oracle11g apex

> ssh root@192.168.99.100 -p 2222
> sqlplus sys/oracle as sysdba
SQL> ALTER USER ANONYMOUS ACCOUNT UNLOCK;
SQL> EXEC DBMS_XDB.SETHTTPPORT(8080);
SQL> COMMIT;
Open your browser access http://192.168.99.100:9090/apxe, then you might see

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: