2

I have a Dockerfile for doing CI.

It uses the contents of a third party tarball which in-turn includes parts of Java Runtime (yes its ugly).

$ git clone xxx
$ cd xxx
$ docker build .

During execution the Dockerfile on ONE host requires ".../jre/.../server/libjvm.so" and executed on ANOTHER host requires ".../jre/.../client/libjvm.so" from that tarball.

The Docker version is everywhere 1.7.1 Nothing is ADDED to the container besides the git repo folder (./) and the tarball. How is this possible? Are there any shared environment variables implicitly passed to docker?

This is how the Dockerfile looks like:

FROM ubuntu:14.04
...
WORKDIR /
RUN wget http://SOME-URL TOOL-PACKAGE
RUN tar xf TOOL-PACKAGE
...
# setup some envs
ENV
# extend PATH
ENV PATH $PATH: ... 
...
COPY ./ src
WORKDIR src
# use tool to generate some input files
RUN SOME-TOOL-BINARY-WHICH-USES-JRE
# continue build with make
RUN make
lipp
  • 5,586
  • 1
  • 21
  • 32
  • How does that part of your `Dockerfile` look like where you build your Java application? Do you have the same effects on both hosts when you build that outside of Docker e.g. on the console? – Henrik Sachse Aug 05 '15 at 07:45
  • The files required are the same for "host" and "host running docker" but different for different host. This is weird to me, as the containers should be completely isolated, isn't it? – lipp Aug 05 '15 at 08:23
  • Yes, container processes always run isolated. But they still share the same system kernel. I do not know based on which information the `java` program decides whether to choose the server or client JVM. Maybe that has something to do based on which kernel you are running. Please have a look at my answer about how to specify the JVM that should be used to have a more reproducible build. – Henrik Sachse Aug 05 '15 at 09:08
  • Unfortunately, the "Toolbox" employing Java is a blackbox and I have no control over which variant is being used. I still ask myself how this could vary between different hosts, since the while "Toolbox" package is self contained and the docker containers are isolated. – lipp Aug 05 '15 at 09:26
  • As I said of course the container processes run isolated. But they still share the system kernel of the host. Means on both hosts you might have different kernels installed that might have effects on the strategy that is used by the `java` program to choose either the client or the server JVM. – Henrik Sachse Aug 05 '15 at 09:43

1 Answers1

0

When you have the possibility to modify the java execution in your build process you could pass the -client or -server parameter explicitly to choose whether the client or server JVM should be used.

For details you could have a look at this other stackoverflow question.

Community
  • 1
  • 1
Henrik Sachse
  • 51,228
  • 7
  • 46
  • 59