Search code examples
javadockerdockerfiledocker-machine

Accessing Host Java from Docker container


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?


Solution

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

    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

    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.