JAR在本地ubuntu:16.04上运行正常,但无法在docker中运行相同的环境

时间:2019-08-02 14:11:21

标签: java postgresql docker

我有一个Java脚本

  1. 从Data / files.txt中读取数据
  2. 将Data / files.txt存储到postgres中
  3. 成功存储后,它将把数据下的文件移动到另一个文件夹Move / files.txt

树是

App.jar
Data/files.txt
Move

场景:

  1. 本地。在主机中安装postgres并在其存储在postgres中的主机中运行jar,然后移至目标文件夹

  2. 如果我在docker中运行它不起作用,而仅显示成功连接的postgres数据库

Dockerfile

FROM openjdk:8
COPY . /usr/src/myapp
WORKDIR /usr/src/myapp

CMD ["java", "-jar", "cdrt.jar"]

我为他们运行docker-compose

postgres
pgadmin 
java-console

java-console在我的主机上安装到用户目录下的/usr/src/myapp

我全部居住3

  1. App.jar
  2. 日期/文件
  3. 移动

有人可以帮我吗?

docker-compose日志-f java

java-console | Connected to the PostgreSQL server successfully.
java-console | timer alrady set
java-console | ERROR: could not open file "/home/app/doc/kyc/kyc_sample.txt" for reading: No such file or directory
java-console |   Hint: COPY FROM instructs the PostgreSQL server process to read a file. You may want a client-side facility such as psql's \copy.
java-console |   Where: SQL statement "COPY cdr_kYC ( 
java-console |   CUSTOMER_PROFILE_ID ,
java-console |  msisdn ,
java-console |  NATIONAL_ID  ,
java-console |  CUSTOMER_NAME ,
java-console |  GENDER  ,
java-console |  DATE_OF_BIRTH ,
java-console |  TRANSACTION_ID  ,
java-console |  PERMANENT_DISTRICT  ,
java-console |  PERMANENT_THANA  ,
java-console |  PERMANENT_ADDRESS ,
java-console |  PRESENT_DISTRICT,
java-console |  PRESENT_THANA  ,
java-console |  PRESENT_ADDRESS  ,
java-console |  CUSTOMER_EMAIL,
java-console |  ENTRY_TYPE ,
java-console |  SUBMIT_TIME ,
java-console |  VERSION_TYPE 
java-console |      ) FROM '/home/app/doc/kyc/kyc_sample.txt'DELIMITER '|' CSV  HEADER"
java-console | PL/pgSQL function cdr_kyc_record(text) line 31 at EXECUTE

0 个答案:

没有答案