ppc64le/build-scripts

Copy docker cli

Closed this issue · 2 comments

When the agent tries to find the Java version of application's JVM's; it runs docker exec command; however it fails to find docker cli. Below is the error snippet:

2021-06-13T14:41:20.497+00:00 | DEBUG | instana-agent-scheduler-thread-2 | ockerProcessImpl | com.instana.agent - 1.1.597 | Running process /usr/lib/jvm/java-11-openjdk-11.0.11.0.9-2.el8_4.ppc64le/bin/java -version via docker exec 675b5fb0e7a60d4d09ab0144c33195436196822703dde73abe4fbecc11fc5c1f
2021-06-13T14:41:20.501+00:00 | DEBUG | instana-agent-scheduler-thread-2 | chineFactoryImpl | com.instana.agent - 1.1.597 | Cannot parse java -version from DockerProcessImpl [pid=47933, parentPid=, inContainerPid=1, containerId=675b5fb0e7a60d4d09ab0144c33195436196822703dde73abe4fbecc11fc5c1f, name=java, directory=/, executable=/usr/lib/jvm/java-11-openjdk-11.0.11.0.9-2.el8_4.ppc64le/bin/java, arguments=[-jar, /deployments/app.jar], userName=, groupName=]
java.io.IOException: Cannot run program "docker": error=2, No such file or directory

To fix this, Docker CLI needs to be copied into PATH. Copying it into /usr/bin directory is fine and works.
Below is the updated dockerfile

`FROM registry.access.redhat.com/ubi8/ubi:8.2

COPY instana-agent-linux-ppcle-64bit.tar.gz /root/
COPY docker /usr/bin/
RUN yum install -y java-11-openjdk-devel
&& cd /root/
&& tar xzf instana-agent-linux-ppcle-64bit.tar.gz
&& rm -rf instana-agent-linux-ppcle-64bit.tar.gz

ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk
INSTANA_AGENT_MODE="APM"
INSTANA_AGENT_KEY="--------------"

CMD ["/root/instana-agent/bin/karaf", "daemon"]`

Make sure to copy the Docker cli in the same folder as that of this dockerfile before building the image.

@awasthan I was trying to reproduce this issue to make sure that the docker-cli installation resolves it, but haven't been able to reproduce it. Also, did you do anything specific to enable the debug logging? I checked the log in my instana agent pod, but I don't see debug logs related to instana-agent-scheduler-thread-xxx. I tried traversing through the cluster details on instana dashboard (webUI). But couldn't reproduce the issue with that either.

It'll help if you provide the steps to reproduce the issue.

@amitsadaphule Here are the steps to enable the debug log:
https://support.instana.com/hc/en-us/articles/360006773812-Procedure-for-enabling-Agent-DEBUG-mode-in-a-Kubernetes-environment

I tested it in k8s 1.13 and k8s 1.21 on ppc64le and issue was present at both environments.