注意其他的源可能导致你的内核和docker的版本不一致,需要升级内核至3.x。
安装:
[root@localhost ~]# rpm -ivh http://dl.Fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
Retrieving http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
warning: /var/tmp/rpm-tmp.JN76fI: Header V3 RSA/SHA256 Signature,key ID 0608b895: NOKEY
Preparing... ########################################### [100%]
1:epel-release ########################################### [100%]
[root@localhost ~]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
[root@localhost ~]# yum -y install docker-io
启动并设置开机自动启动
[root@localhost ~]# service docker start
Starting cgconfig service: [确定]
Starting docker: [确定]
[root@localhost ~]# chkconfig docker on
安装oracle镜像
docker pull sath89/oracle-xe-11g
root@- rac1:/home/# docker images
Run with 8080 and 1521 ports opened:
docker run -d -p 8080:8080 -p 1521:1521 sath89/oracle-xe-11g
Run with data on host and reuse it:
docker run -d -p 8080:8080 -p 1521:1521 -v /my/oracle/data:/u01/app/oracle sath89/oracle-xe-11g
可以看到创建的container已经在运行中
[root@-rac1 ~]~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9e893d773494 sath89/oracle-xe-11g "/entrypoint.sh " 15 minutes ago Up 15 minutes 0.0.0.0:1521->1521/tcp,0.0.0.0:8080->8080/tcp cLever_chandrasekhar
进入oracle container
[root@-rac1 ~]~$ docker exec -it 9e893d773494 /bin/bash
root@9e893d773494:/# su oracle
oracle@9e893d773494:~$ $ORACLE_HOME/bin/sqlplus / as sysdba
sql*Plus: Release 12.1.0.2.0 Production on Fri Feb 24 03:03:00 2017
copyright (c) 1982,2014,Oracle. All rights reserved.
至此数据库镜像完成