2

我正在尝试使用 apama-builder 构建一个简单的 HelloWorld docker 映像。但是我收到以下错误:

INFO: copying the project file from /app/HelloWorld to output directory /app/deployed
ERROR: Failed to create correlator initialization list: /app/deployed
The command '/bin/sh -c engine_deploy --outputDeployDir /app/deployed /app/HelloWorld' returned a non-zero code: 100

我的 Docker 文件如下所示:

# Use the build environment
FROM store/softwareag/apama-builder:10.3 as builder

# Copy project assets into build environment
COPY --chown=1724:1724 . /app/HelloWorld

# Deploy the apama project
RUN engine_deploy --outputDeployDir /app/deployed /app/HelloWorld

# Add any additional build steps you may have, such as building plugins, here
# RUN ...

# Final image is based on the runtime base image
FROM store/softwareag/apama-correlator:10.3

# Copy deployed project from the build environment
COPY --chown=1724:1724 --from=builder /app/deployed /app/deployed

# Add copies for any additional build artifacts created in the build environment
# COPY --from=builder ...

WORKDIR /app

# Run the deployed project
CMD ["correlator", "--config", "Project_deployed", "--logfile", "/dev/stdout"]

注意我使用的是 CentOS,我的 HelloWorld 应用程序位于 /app/HelloWorld,我希望输出位于 /app/deployed。

4

1 回答 1

2

有几个问题,但它源于部署过程没有以 root 身份运行,因此无法创建输出目录。它最初也愚弄了我:)

首先是

# Copy project assets into build environment
COPY --chown=1724:1724 . /app/HelloWorld

工作,但 engine_deploy 不会因为它无法访问/app/deployed

因此,如果您将 engine_deploy 行更改为

RUN engine_deploy --outputDeployDir ${APAMA_WORK}/deployed /app/HelloWorld

它通常会在“工作”目录中创建可运行的应用程序部署/apama_work

现在因为它不是您放置它的位置,您需要从构建器更改副本

# Copy deployed project from the build environment
COPY --chown=1724:1724 --from=builder ${APAMA_WORK}/deployed ${APAMA_WORK}/deployed

最后需要更改 CMD 行

# Run the deployed project
CMD ["correlator", "--config", "deployed", "--logfile", "/dev/stdout"]

匹配输出目录

于 2019-04-02T13:55:58.520 回答