为什么我的dockerfile一直抛出下面的错误,我只是在docker-compose中使用db服务执行sqlplus命令,以便它连接到同一个容器。同样的命令在容器上工作。有什么想法...
docker-compose:
version: '2.4'
services:
db:
image: oracle19c:new
environment:
- ORACLE_SID=ORCLCDB
- ORACLE_PDB=ORCLPDB1
- ORACLE_PWD=password
ports:
- 1521:1521
volumes:
#- oracle:/opt/oracle/oradata
#- ./scripts:/scripts
#- ./software:/software
- ./scripts/:/opt/oracle/scripts/startup/
- ./utPLSQL-develop/utPLSQL-develop/:/tmp/utPLSQL/
healthcheck:
test: [ "CMD", "/opt/oracle/checkDBStatus.sh"]
interval: 10s
timeout: 10s
retries: 190
utplsql:
build: ./
depends_on:
db:
condition: service_healthy
environment:
- ORACLE_SID=ORCLCDB
- ORACLE_PDB=ORCLPDB1
- ORACLE_PWD=password
#######################################
dockerfile:
FROM oracle19c:new
# Setup ORACLE ENV
ENV ORACLE_SID=ORCLCDB
ENV ORACLE_PDB=ORCLPDB1
ENV ORACLE_PWD=password
# Set up the command to wait for the Oracle DB, then install utPLSQL
CMD sqlplus sys/password123@db:1521/ORCLPDB1 as sysdba @/tmp/utPLSQL/source/install_headless.sql
#########################################
构建时出错:
compose-utplsql-1 |
compose-utplsql-1 | SQL*Plus: Release 19.0.0.0.0 - Production on Thu Oct 12 16:25:30 2023
compose-utplsql-1 | Version 19.3.0.0.0
compose-utplsql-1 |
compose-utplsql-1 | Copyright (c) 1982, 2019, Oracle. All rights reserved.
compose-utplsql-1 |
compose-utplsql-1 |
compose-utplsql-1 | ERROR:
compose-utplsql-1 | ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA
compose-utplsql-1 |
compose-utplsql-1 |
compose-utplsql-1 | Enter user-name:
compose-utplsql-1 exited with code 0
1条答案
按热度按时间goqiplq21#
如果你想在创建数据库后灵活地运行脚本,可以使用gvenzl的images。这些都是很棒的,为开发人员!
创建脚本文件夹并添加脚本
Oracle数据库启动例程配置为吃掉此文件夹中的所有脚本
启动数据库服务
以app用户'dev'登录
我被分配到新的23 c角色了吗?
从这里,您可以将整个互联网加载到Oracle数据库中。
祝你好运!