运行 Java 来自 node.js dokku 容器的命令行

Run Java command line from node.js dokku container

我有一个 dokku 容器 运行 一个 node.js 应用程序,我的后端需要使用 java8 到 运行 一些命令行。我的服务器出现以下错误消息:

[Error: Command failed: /bin/sh -c java /bin/sh: 1: java: not found ]

如何在我的 dokku 容器中访问 java8

您需要在当前镜像的基础上创建您自己的镜像(或者修改您当前的 Dockerfile,如果您已有它)并向其中添加 java。如何添加 java 取决于基础图像和您需要的 java 。这里是 ubuntu based image and oracle java8

的示例

之后,您可以 run container from that image. You could use your local image or you could push 您的图像到 public 或私人注册表。

在这里Dockerfile documentation and best practices创建它。