I need to set an environment variable CLASSPATH. In that variable I need to set the result of a command:
hadoop classpath --glob
This will return a ton of java libraries and they all need to get set into that CLASSPATH variable. The big problem is that I can only run this command after the docker build is complete, meaning I have to do it in the ENTRYPOINT. But I just cant get it working. I tried differen approaches:
ENTRYPOINT ["sh", "-c", "export CLASSPATH=$(hadoop classpath --glob) ...."
ENTRYPOINT ["sh", "-c", "set CLASSPATH=$(hadoop classpath --glob) ...."
ENTRYPOINT ["sh", "-c", "CLASSPATH=$(hadoop classpath --glob) ...."
ENTRYPOINT ["sh", "-c", "/bin/bash && export CLASSPATH=$(hadoop classpath --glob) ...."
But nothing of it is working. The command itself is working, I tested it using:
ENTRYPOINT ["sh", "-c", "echo $(hadoop classpath --glob) >> /tmp/classpath.tmp ...."
This file contains the correct content after startup. So there is just a problem with setting and persisting the environment variable. How am I supposed to set the environment variable? Usually you use something like
ENV CLASSPATH="some classpath"
But here I cant use the ENV statement since it wont process the command $(hadoop classpath --glob)