简体   繁体   中英

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. A docker shipped library might be a dependence for other tool/library compilation. this question comes with me when I tried some open source projects, eg, 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 ). 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?

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.

So can anyone explain the right way to use container-build jvm for my eclipse in the host machine? 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. I use IntelliJ, which has a number of ways of letting you deploy to and debug remote Java programs or libraries. Whatever the right way to do this is in Eclipse, the same would apply to a Java program running in a local Docker container.

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. 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. 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.

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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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