从Docker容器访问Host Java [英] Accessing Host Java from Docker container

查看:165
本文介绍了从Docker容器访问Host Java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Docker主机中安装了Java。现在,我希望它能够连接到我的Docker容器。我不想在容器上再次安装。

I have Java installed in my docker host. Now I want that to be able to my docker containers. I don't want to install again on the containers. Do we have any workaround for that?

推荐答案

我们克服了使用Docker的目的,该目的是将容器与主机分离

Well it defeat the purpose of using Docker that is to decouple your container from the host.

如果您正在寻找一种解决方法,则可以将Java主机安装目录挂载到容器中,但最好在容器中和容器中使用相同的操作系统主机

If you are looking for a workaround you can probably just mount your Java host installation directory in you container but is better to use the same OS both in the container and in the host

我认为这是不值得的,您不必安装 Java,只需从已经包含Java的映像开始(或自己创建一个) ,使用打开的jdk非常简单。

I think is a not worth it and you don't have to "install" Java just start from an Image (or create one yourself) that already contains Java, with open jdk is pretty simple.

这篇关于从Docker容器访问Host Java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆