简体   繁体   English

在Docker容器中执行命令并以Java获取输出

[英]Execute commands in Docker Container and get Output in Java

I would like to run a Python Tool (Volatility) in a Docker Container and execute commands inside the container to receive the output in a Java application. 我想在Docker容器中运行Python工具(易失性)并在容器内执行命令以接收Java应用程序中的输出。 The problem is that Volatility needs Python to execute the commands, how do I connect Python with the tool running in docker and get the output of the command in a Java application? 问题是Volatility需要Python执行命令,如何将Python与docker中运行的工具连接并在Java应用程序中获取命令的输出?

Summary Dockerfile : Dockerfile摘要:

FROM openjdk:11-sid-slim
RUN apt-get update && apt-get install -y python && apt-get clean && rm /var/lib/apt/lists
RUN call your volatility installation command or script here

That should give you a basic "frame" for your java application then you either append your application specific commands to add it up, or you reuse that image to build a second one with your application. 那应该为您的Java应用程序提供一个基本的“框架”,然后您可以添加特定于应用程序的命令以将其添加起来,或者您可以重复使用该映像来与您的应用程序一起构建第二个映像。 The later is a better if you have several applications to dockerize. 如果您有多个应用程序要进行dockerize,则后者会更好。

Not a java expert: maybe there are better base images to use for spring boot (you mentioned it in the question tags). 不是Java专家:也许有更好的基础映像可用于Spring Boot(您在question标签中提到过)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM