Hi thanks for replying!
Let me provide more details. The image I change is
FROM kong/kong-gateway:2.8.1.1-alpine
So I have used musl (but also default, nginx and all as well)
Currently my Dockerfile is
FROM kong/kong-gateway:2.8.1.1-alpine
USER root
# Dynatrace OneAgent
ARG DT_API_URL
ARG DT_API_TOKEN
ARG DT_ONEAGENT_OPTIONS="flavor=musl&include=nginx"
ENV DT_HOME="/opt/dynatrace/oneagent"
ENV DT_LOGLEVELCON=info
RUN mkdir -p "$DT_HOME" && \
wget --quiet -O "$DT_HOME/oneagent.zip" "$DT_API_URL/v1/deployment/installer/agent/unix/paas/latest?Api-Token=$DT_API_TOKEN&$DT_ONEAGENT_OPTIONS" && \
unzip -d "$DT_HOME" "$DT_HOME/oneagent.zip" && \
rm "$DT_HOME/oneagent.zip"
RUN apk --no-cache add curl jq
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT [ "/opt/dynatrace/oneagent/dynatrace-agent64.sh", "/docker-entrypoint.sh", "kong", "docker-start" ]
USER kong
To be honest there was NO entrypoint in the original Dockerfile, somehow this container knew that starting point is /docker-enrtypoint.sh (which starts kong nginx smth, probably set in the original “FROM” image). So I knew I have to inject the LD_PRELOAD before /docker-entrypoint.sh is magically called. I came to this long ENTRYPOINT as you can see above. This runs DT magic first with a set o 3 parameters. And I think this made a change… I have to note that running /dynatrace-agent64.sh wont set the LD_PRELOAD outside the script, dunno why? Exported var is visible inside the script but not when it finishes
bash-5.1# /opt/dynatrace/oneagent/dynatrace-agent64.sh
Info: Using DT_HOME: /opt/dynatrace/oneagent
bash-5.1#
bash-5.1# env |grep LD
bash-5.1# env |grep DT
DT_HOME=/opt/dynatrace/oneagent
DT_LOGLEVELCON=info
Also maybe you will need that, the LD_PRELOAD library does not have to overwrite any existing one as nginx does not seam to use the one exported by the DT scritpt?
bash-5.1# ldd /usr/local/openresty/nginx/sbin/nginx
/lib/ld-musl-x86_64.so.1 (0x7f3d2958f000)
libluajit-5.1.so.2 => /usr/local/openresty/luajit/lib/libluajit-5.1.so.2 (0x7f3d28ea4000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x7f3d28d03000)
libopentracing.so.1 => /usr/local/kong/lib/libopentracing.so.1 (0x7f3d28aeb000)
libssl.so.1.1 => /usr/local/kong/lib/libssl.so.1.1 (0x7f3d28857000)
libcrypto.so.1.1 => /usr/local/kong/lib/libcrypto.so.1.1 (0x7f3d28366000)
libz.so.1 => /lib/libz.so.1 (0x7f3d2834c000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7f3d28332000)
libc.musl-x86_64.so.1 => /lib/ld-musl-x86_64.so.1 (0x7f3d2958f000)
Anyway the nested and long ENTRYPOINT made a change:
bash-5.1# ps
PID USER TIME COMMAND
1 kong 0:00 bash /docker-entrypoint.sh kong docker-start
11 root 0:00 /bin/bash
2136 kong 0:00 perl /usr/local/openresty/bin/resty /usr/local/bin/kong prepare -p /usr/local/kong kong docker-start
2138 kong 0:00 /usr/local/openresty/nginx/sbin/nginx -p /tmp/resty_xxxxxx/ -c conf/nginx.conf
2169 kong 0:00 nginx -v
2185 root 0:00 ps
# and container exits to my local linux shell
root@EPPLWROW0270:~/kong# docker logs kong-xxxxxx
Info: Using DT_HOME: /opt/dynatrace/oneagent
*** Welcome to the rocketship ***
Running checks...
Enjoy the flight!
/
2022-07-22 12:17:56.641 UTC [0000085a] info [native] ... last message repeated 3 times ...
xxxxx a lot of lines, removed for serurity and clearnes
2022-07-22 12:18:01.282 UTC [0000085a] info [native] Detected static modules: ndk_http_module (0x5635c723de40) a lot of them nxxxxxxxxxxxxxxx
2022-07-22 12:18:01.282 UTC [0000085a] info [native] Registering agent via core module hook (default; custom array registration viable as well)
2022-07-22 12:18:01.282 UTC [0000085a] info [native] Nginx successfully instrumented
2022-07-22 12:18:01.283 UTC [0000085a] info [native] Agent successfully loaded from '/opt/dynatrace/oneagent/agent/bin/1.243.166.20220701-145555/linux-x86-64/liboneagentnginx.so'
Error: could not prepare Kong prefix at /usr/local/kong: could not find OpenResty 'nginx' executable. Kong requires version 1.19.3.1 to 1.19.9.1
Run with --v (verbose) or --vv (debug) for more details
So DT agent is UP but somehow Kong is complaining about the altered nginx and exits, along with container that dies (I mean I think messing with .so libraries might have caused that?) Why? If I run unmodified container (no entrypoint used so DT wont be started at all)
bash-5.1# nginx -v
nginx version: openresty/1.19.9.1
So the version is within the scope of supported versions by Kong however it is not starting up… I have no idea what to do next, maybe test latest source container.