简体   繁体   English

如何在主机中使用docker-built library&bin

[英]How to use docker-built library&bin in the host machine

My question is how to use docker container-built software&library in the host machine. 我的问题是如何在主机中使用docker容器构建的软件和库。 A docker shipped library might be a dependence for other tool/library compilation. docker附带的库可能是对其他工具/库编译的依赖。 this question comes with me when I tried some open source projects, eg, openj9. 当我尝试一些开源项目时,这个问题随我而来,例如openj9。

For example, I built one openJ9 VM, a Java VM that is similar to the HotSpot JVM, in a docker container, following ( building instruction ). 例如,我在docker容器中构建了一个openJ9 VM,一个类似于HotSpot JVM的Java VM,遵循( 构建指令 )。 The process is OK, but the next problem is how I can config the container-built jvm, residing at ~/openj9-openjdk-jdk8/build/linux-x86_64-normal-server-release/ inside of container, in the eclipse that resides at host machine? 这个过程没问题,但接下来的问题是我如何配置容器构建的jvm,驻留在~/openj9-openjdk-jdk8/build/linux-x86_64-normal-server-release/ container的容器中,在eclipse中住在主机?

I might be in the wrong way in using docker, feeling there would be a potential conflict, as the container environment for container-built jvm possibly differ from the host machine environment. 我可能在使用docker时出错了,感觉会有潜在的冲突,因为容器构建的jvm的容器环境可能与主机环境不同。

So can anyone explain the right way to use container-build jvm for my eclipse in the host machine? 那么有人能解释在主机上使用容器构建jvm的正确方法吗? Thanks 谢谢

There are two distinct usage modes here. 这里有两种不同的使用模式。 I'm not sure which one of these you're asking about. 我不确定你问的是哪一个。 Maybe you're asking about both. 也许你问两个问题。

If you want to run the JVM inside of the container in which you built it, then you've got the same case as if you were running the JVM on a remote server and wanting to connect your local Eclipse to it. 如果要在构建它的容器内运行JVM,那么就像在远程服务器上运行JVM并希望将本地Eclipse连接到它一样。 I use IntelliJ, which has a number of ways of letting you deploy to and debug remote Java programs or libraries. 我使用IntelliJ,它有许多方法可以让你部署和调试远程Java程序或库。 Whatever the right way to do this is in Eclipse, the same would apply to a Java program running in a local Docker container. 无论正确的方法是在Eclipse中,这同样适用于在本地Docker容器中运行的Java程序。

If you're talking about taking the JVM package you've built inside a container, pulling it out of the container, and running it on your local workstation, this will work just like any other case where you build an executable or library on one machine to be used on another. 如果你正在谈论你已经在容器内部构建了JVM包,将它从容器中拉出来,并在本地工作站上运行它,这就像你在一个容器上构建可执行文件或库的任何其他情况一样。机器在另一个上使用。 You'd have the best chance of doing this without complications if you were running the same basic OS in both environments, like say Ubuntu of similar versions both inside and outside the container. 如果您在两种环境中运行相同的基本操作系统,那么您最有可能不会出现这种情况,例如在容器内部和外部使用类似版本的Ubuntu。 You wouldn't be able to build a JVM binary inside Ubuntu running in a Docker container, and then pull it out and run it on your Windows workstation hosting Docker. 您将无法在Docker容器中运行的Ubuntu中构建JVM二进制文件,然后将其拉出并在托管Docker的Windows工作站上运行它。

Actually...I realize that there's a third option. 实际上......我意识到还有第三种选择。 If you want to run your Java program inside a Docker container, it may be that Eclipse has specific support for doing this...deploying to and running a Java program inside a Docker host running on the same workstation as Eclipse. 如果你想在Docker容器中运行你的Java程序,可能是Eclipse特别支持这样做......在与Eclipse相同的工作站上运行的Docker主机内部署和运行Java程序。 It would be doing basically the same thing as it would be for a remote server, but it very well could streamline this use case knowing that you are targeting a local Docker container. 它与基于远程服务器的操作基本相同,但它可以简化此用例,因为您知道自己的目标是本地Docker容器。

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

相关问题 由于“无法删除'Coding Library / bin / assets'。”,因此未构建该项目。 - The project was not built due to “Could not delete 'Coding Library/bin/assets'.”. 如何不使用内置库函数InetAddress.getbyName()获得任何主机的IP地址? - How to get IP address of any host without using the built in library function InetAddress.getbyName()? 我如何使用pre_built库 - how do I use pre_built library 如何使用从主机到 docker mysql 服务器的 JDBC 连接 - How to use JDBC connection from host to a docker mysql server Kafka 和 zookeeper docker 容器在主机上与我的 api 对话 - Kafka and zookeeper docker containers talking to my api on the host machine 如何在Docker中设置服务主机? - How to set host of service in Docker? Kafka:从宿主机发布的事件不会被运行在 Docker 中的应用程序消费 - Kafka: events published from the host machine are not consumed by the application running in Docker 从Java使用docker-machine create - Use docker-machine create from java 我的带有内置ssl证书的库如何允许使用默认证书 - How can my library with built in ssl certificate also allow use with default certs docker镜像可以使用来自主机的可执行文件吗? - Can a docker image use executable from the host?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM