无法从 docker compose 执行 oracle 数据设置脚本
我试图在 Oracle 容器启动并运行后设置 Oracle 数据,下面是我的撰写文件:
version: '3'
services:
oracle:
image: absolutapps/oracle-12c-ee
container_name: oracle-docker
ports:
- 8080:8080
- 1521:1521
environment:
CASSANDRA_BROADCAST_ADDRESS: 127.0.0.1
ORACLE_ALLOW_REMOTE: "true"
volumes:
- ./scripts/oracle-init.sh:/oracle-init.sh
oracle-init.sh:
#!/usr/bin/env bash
echo "### SETUP EXECUTION! ###"
sqlplus -s "system/oracle@localhost:1521/orcl /scripts/init-oracle.sql"
echo "### SETUP EXECUTED! ###"
init-oracle.sql :
CREATE USER ot_consumer_tryout IDENTIFIED BY ot_consumer_tryout;
谁能帮我看看上面的片段有什么问题。我的 docker 容器开始启动,但 sql 脚本不执行,这是来自终端的日志:
oracle-docker |运行初始化脚本... 甲骨文码头工人 | /oracle.init.d/ 中的初始化脚本:忽略 /oracle.init.d/* 甲骨文码头工人 | 甲骨文码头工人 |完成脚本后我们就可以开始了
I am trying to set up oracle data once my oracle container is up and running, below is my compose file:
version: '3'
services:
oracle:
image: absolutapps/oracle-12c-ee
container_name: oracle-docker
ports:
- 8080:8080
- 1521:1521
environment:
CASSANDRA_BROADCAST_ADDRESS: 127.0.0.1
ORACLE_ALLOW_REMOTE: "true"
volumes:
- ./scripts/oracle-init.sh:/oracle-init.sh
oracle-init.sh:
#!/usr/bin/env bash
echo "### SETUP EXECUTION! ###"
sqlplus -s "system/oracle@localhost:1521/orcl /scripts/init-oracle.sql"
echo "### SETUP EXECUTED! ###"
init-oracle.sql :
CREATE USER ot_consumer_tryout IDENTIFIED BY ot_consumer_tryout;
Can anyone help me what is wrong with above snippets. My docker container getting started but sql script does not execute ,here is the log from terminal:
oracle-docker | Running init scripts...
oracle-docker | Init scripts in /oracle.init.d/: Ignoring /oracle.init.d/*
oracle-docker |
oracle-docker | Done with scripts we are ready to go
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看您创建的卷
- ./scripts/oracle-init.sh:/oracle-init.sh
这意味着在您的容器内,该文件位于“/oracle-init.sh”中,但您的
根据您的容器日志,容器可能会在不同的位置期待具有文件夹名称
oracle.init.d
的内容。oracle-init.sh
正在尝试运行/scripts/init-oracle.sql
,希望您的映像已经拥有它,否则您还必须将其安装在撰写文件中。Look at the volume you created
- ./scripts/oracle-init.sh:/oracle-init.sh
which means inside your container the file is in '/oracle-init.sh' but your
container might be expecting in a different location something with folder name
oracle.init.d
as per your container log.oracle-init.sh
is trying to run/scripts/init-oracle.sql
, hope your image already has it otherwise you will have to mount it as well in compose file.