为什么我的Docker-Compose在初始化我的Oracle数据库后会卡住,而不是继续进行下一个服务?
我正在尝试使用Docker Compose更新项目的Docker,并使用Oracle Database 19c Enterprise Edition,WebLogic Server 12.1.4和Java 8的Java Server JRE。 我编写了一个脚本,该脚本为DB和Weblogic服务器创建基本图像,然后继续使用Docker-Compose构成我编写的YAML。
项目的结构由Oracle Base图像组成,从Github上的官方Oracle图像中提取,然后我创建了自己的Dockerfiles来扩展这些图像。我的问题是在Oracle DB Dockerfile上,我不确定如何进行。在这一点上,安装完成数据库后会卡住,并且没有继续进行WebLogic安装,甚至没有创建单独的容器。.
ENV ORACLE_PWD="password"
ENV ORACLE_SID=ORCLCDB
ENV ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
ADD db-assets /tmp/db-assets
COPY ./wait_db.sh $ORACLE_BASE/
COPY ./runDBscripts.sh $ORACLE_BASE/
COPY ./runOracle.sh $ORACLE_BASE/
COPY ./startDB.sh $ORACLE_BASE/
USER root
RUN chmod ug+x $ORACLE_BASE/*.sh
USER oracle
RUN $ORACLE_BASE/runOracle.sh &&\
$ORACLE_BASE/wait_db.sh && \
$ORACLE_BASE/runDBscripts.sh
CMD $ORACLE_BASE/wait_db.sh
我已经尝试了一堆组合来实现此功能。我是否在不应该有的地方添加了任何命令? docker-compose.yml:
version: '2'
services:
db:
build:
context: db/
dockerfile: Dockerfile
image: oracle/database
ports:
- "10000:1521"
- "10001:22"
shm_size: 1G
app:
build:
context: app/
dockerfile: Dockerfile
image: oracle/weblogic:12.2.1.4
ports:
- 10003:7001
- 10004:7002
depends_on:
- db
command: >
/bin/bash -c "
echo sleeping while db is starting;
sleep 90;
#script for starting a managed server on weblogic@
"
我花了很多时间试图做这项工作,这真的让我感到沮丧,因为我无法做到正确。任何帮助都将不胜感激
I am trying to update the docker of my project using docker compose, using the Oracle Database 19c Enterprise edition, WebLogic Server 12.1.4 and the Java Server JRE for java 8.
I have written a script that creates the base images for the DB and weblogic server and then proceeds to use the docker-compose up for the yaml that I have written.
The structure of the projects consists of the oracle base images, pulled from the official oracle images on github, and then I have created my own Dockerfiles to extend these images. My issue is on the Oracle DB Dockerfile, where I am not sure on how to proceed. At this point the installation gets stuck after completing the database and doesnt proceed to weblogic installation and not even creating a seperate container..
ENV ORACLE_PWD="password"
ENV ORACLE_SID=ORCLCDB
ENV ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
ADD db-assets /tmp/db-assets
COPY ./wait_db.sh $ORACLE_BASE/
COPY ./runDBscripts.sh $ORACLE_BASE/
COPY ./runOracle.sh $ORACLE_BASE/
COPY ./startDB.sh $ORACLE_BASE/
USER root
RUN chmod ug+x $ORACLE_BASE/*.sh
USER oracle
RUN $ORACLE_BASE/runOracle.sh &&\
$ORACLE_BASE/wait_db.sh && \
$ORACLE_BASE/runDBscripts.sh
CMD $ORACLE_BASE/wait_db.sh
I have tried a bunch of combinations to get this working. Have I added any commands where there shouldn't have been?
docker-compose.yml:
version: '2'
services:
db:
build:
context: db/
dockerfile: Dockerfile
image: oracle/database
ports:
- "10000:1521"
- "10001:22"
shm_size: 1G
app:
build:
context: app/
dockerfile: Dockerfile
image: oracle/weblogic:12.2.1.4
ports:
- 10003:7001
- 10004:7002
depends_on:
- db
command: >
/bin/bash -c "
echo sleeping while db is starting;
sleep 90;
#script for starting a managed server on weblogic@
"
I have spent a lot of time trying to make this work and it really frustrates me that I can't get it right. Any help will be really appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
找到了!我使事情变得更加复杂,我的解决方案是使Dockerfile尽可能简单,只复制数据库脚本。并切换到用户Oracle。我还遵循了这篇文章我如何检查Oracle是否是在Docker?
设置健康检查,一切正常。
Found it! I was making things way more complicated, my solution is to make the Dockerfile as simple as possible, only copying the database scripts. and switching to user oracle. I also followed this post How do I check if Oracle is up in Docker?
to setup the healthcheck and everything works perfectly.