docker pentaho mysql驱动程序问题

我在Windows 10上使用Docker来创build一个pentaho和mysql映像,这个映像将在我用docker network create定义的networking上作为容器运行。

目的是(作为第一步),我将运行一个.KTR文件与pan.sh将从.csv文件读取数据库连接参数,并将其放置到环境;

获取数据库连接参数

接下来,第二个.KTR使用上面的环境参数来检查数据库是否存在。

检查DB存在

问题是当我用docker-compose“旋转”我的项目时,第二步失败,找不到驱动程序问题。 我把我需要的驱动程序放在pentaho容器的lib目录中,但我猜这是不正确的?

最终的目的是进行一个转换,从一个OpenEdge数据库读取的数据经过pentaho中的一系列步骤并写入mysql数据库。

这里是支持文件; Dockerfile;

FROM java:8-jre MAINTAINER M Beynon # Set required environment vars ENV PDI_RELEASE=7.1 \ PDI_VERSION=7.1.0.0-12 \ CARTE_PORT=8181 \ PENTAHO_JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 \ PENTAHO_HOME=/home/pentaho # Create user RUN mkdir ${PENTAHO_HOME} && \ groupadd -r pentaho && \ useradd -s /bin/bash -d ${PENTAHO_HOME} -r -g pentaho pentaho && \ chown pentaho:pentaho ${PENTAHO_HOME} # Add files RUN mkdir $PENTAHO_HOME/docker-entrypoint.d COPY docker-entrypoint.sh $PENTAHO_HOME/scripts/ RUN chown -R pentaho:pentaho $PENTAHO_HOME RUN apt-get update && apt-get install -y libwebkitgtk-1.0-0 RUN apt-get update && apt-get install -y dos2unix RUN dos2unix $PENTAHO_HOME/scripts/docker-entrypoint.sh && apt-get --purge remove -y dos2unix && rm -rf /var/lib/apt/lists/* # Switch to the pentaho user USER pentaho # Download PDI RUN /usr/bin/wget \ --progress=dot:giga \ http://downloads.sourceforge.net/project/pentaho/Data%20Integration/${PDI_RELEASE}/pdi-ce-${PDI_VERSION}.zip \ -O /tmp/pdi-ce-${PDI_VERSION}.zip && \ /usr/bin/unzip -q /tmp/pdi-ce-${PDI_VERSION}.zip -d $PENTAHO_HOME && \ rm /tmp/pdi-ce-${PDI_VERSION}.zip ENV KETTLE_HOME=$PENTAHO_HOME/data-integration \ PATH=$KETTLE_HOME:$PATH WORKDIR $KETTLE_HOME ENTRYPOINT ["../scripts/docker-entrypoint.sh"] 

入口点

 #!/bin/bash # based on https://github.com/aloysius-lim/docker-pentaho-di/blob/master/docker/Dockerfile #exit script if any command fails (non-zero value) set -e cd resources cp mysql-connector-java-5.1.42-bin.jar ../lib/ cp PROGRESS_DATADIRECT_JDBC_OE_ALL.jar ../lib cd ../ echo 'Drivers copied!' echo '' echo 'Running transformation!' #run a transformation (get db credentials) ./pan.sh -file=resources/Read-DBs.ktr #run a transformation (does the db exist) ./pan.sh -file=resources/GoldBi-Exists.ktr #redirect input variables exec "$@" 

Docker撰写文件;

 version: "2" services: db: image: mysql:latest networks: - my-pdi-network environment: - MYSQL_ROOT_PASSWORD=tbitter - MYSQL_DATABASE=mysql-db ports: - "3307:3306" volumes: - ./goldbi:/var/lib/mysql pdi: image: my-pdi-image:latest networks: - my-pdi-network volumes: - C:\Docker-Pentaho\resource:/home/pentaho/data-integration/resources networks: my-pdi-network: The error coming from pentaho; 2017/05/30 15:28:56 - Table exists.0 - Error occurred while trying to connect to the database 2017/05/30 15:28:56 - Table exists.0 - 2017/05/30 15:28:56 - Table exists.0 - Error connecting to database: (using class org.gjt.mm.mysql.Driver) 2017/05/30 15:28:56 - Table exists.0 - Communications link failure 2017/05/30 15:28:56 - Table exists.0 - 2017/05/30 15:28:56 - Table exists.0 - The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. 

非常感谢。

PS有谁知道如何防止重build所有东西的构build,即使这只是对dockerfile或入口点文件的小改动?

我似乎find了解决办法; 有两个问题。 第一个似乎是在第一个转换中设置的ENVvariables在第二个转换中没有被使用。 第二个是在第二个转换中主机名是错误的(DB-Exists)。 它应该是'db',这是在docker-compose文件中为容器指定的名称。 由于包含的内容都是在我指定的自定义networking上运行的,所以它们可以通过自己的服务名称自动“对话”。