简体   繁体   English

Docker 中的 Oracle 12c

[英]Oracle 12c in Docker

For a while I'm searching for a good way to run Oracle in Docker.有一段时间我正在寻找一种在 Docker 中运行 Oracle 的好方法。 It was always ending up in huge images, and slow starting containers.它总是以巨大的图像和缓慢启动的容器结束。

But today I saw the link: https://store.docker.com/images/oracle-database-enterprise-edition但是今天我看到了链接: https : //store.docker.com/images/oracle-database-enterprise-edition

Is this just an official Oracle12c we can use (I was able to pull and start it) or is this only for enterprise users?这只是我们可以使用的官方 Oracle12c(我能够拉取并启动它)还是仅适用于企业用户?

Can I customize this image with my own .sql scripts?我可以使用自己的 .sql 脚本自定义此图像吗? (With some entrypoint)? (有一些入口点)?

You can follow the following steps:您可以按照以下步骤操作:

  1. docker login登录

  2. docker pull store/oracle/database-enterprise:12.2.0.1 docker pull store/oracle/database-enterprise:12.2.0.1

  3. docker run -d -it --name oracledb12c -P store/oracle/database-enterprise:12.2.0.1 docker run -d -it --name oracledb12c -P store/oracle/database-enterprise:12.2.0.1

  4. docker port containerID 1521/tcp (you will can connect to the datbase outside of the container using this port) docker port containerID 1521/tcp(您可以使用此端口连接到容器外部的数据库)

$ docker ps #check while the container status is not healthy)

  • Connect with sqlplus docker exec -it containerID bash -c "source /home/oracle/.bashrc; sqlplus /nolog"连接sqlplus docker exec -it containerID bash -c "source /home/oracle/.bashrc; sqlplus /nolog"

  • Connect with jdbc: USER: sys PASSWD: Oradoc_db1 jdbc:oracle:thin:@(description=(address=(host=127.0.0.1)(protocol=tcp)(port=portNumner)) (connect_data=(service_name=ORCLPDB1.localdomain)))与jdbc连接: USER: sys PASSWD: Oradoc_db1 jdbc:oracle:thin:@(description=(address=(host=127.0.0.1)(protocol=tcp)(port=portNumner)) (connect_data=(service_name=ORCLPDB1.localdomain) )))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM