Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release does not work with Alpine docker image #72

Closed
etsangsplk opened this issue Nov 27, 2018 · 10 comments · Fixed by #209
Closed

Release does not work with Alpine docker image #72

etsangsplk opened this issue Nov 27, 2018 · 10 comments · Fixed by #209

Comments

@etsangsplk
Copy link

Looks lie all the release is built with Ubuntu and the associated dev packages. This casues a lot of issue loading that in alpine. There are suggestion of installtion lib-compat but it will error out on standard c library symbol on function call.

.
[emerg] dlopen() "/usr/local/openresty/nginx/modules/ngx_http_opentracing_module.so" failed (Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /usr/local/openresty/nginx/modules/ngx_http_opentracing_module.so))

@EduardoAC
Copy link

@etsangsplk you can add libc6-compat to solve the problem. However, I couldn't solve the next one where it's required __sprintf_chk, which in theory must be solve by adding glibc.

However, the both libraries conflict and it's not an easy way to install the second one. I got stuck at this point to try to find a better solution

@etsangsplk
Copy link
Author

@EduardoAC I alresdy tried the libc approach and was stuck with the same.

@EduardoAC
Copy link

Me too, that's why I am waiting for ideas from the community

@Yaytay
Copy link

Yaytay commented Mar 2, 2019

Dockerfile-nginx-alpine.txt
I spent a couple of hours yesterday converting the Dockerfile into one based on Alpine (only using Zipkin 'cos that's all I needed, but should be easy enough to modify for others).
It seems to work OK.

I can't offer to support it because I think I'm actually going to want to base off OpenResty.

I've attached the Dockerfile if anyone is interested.

@KhadijaAmmar
Copy link

KhadijaAmmar commented Apr 19, 2019

Dockerfile-nginx-alpine.txt
I spent a couple of hours yesterday converting the Dockerfile into one based on Alpine (only using Zipkin 'cos that's all I needed, but should be easy enough to modify for others).
It seems to work OK.

I can't offer to support it because I think I'm actually going to want to base off OpenResty.

I've attached the Dockerfile if anyone is interested.

Thank you for providing this docker file showing how to install plugins,
However, I don't get why you use ln -s and create symoble links?

     ln -s /usr/local/lib/libopentracing.so.1.5.1 /usr/local/lib/libopentracing.so.1  && \
     ln -s /usr/local/lib/libopentracing.so.1 /usr/local/lib/libopentracing.so && \
     ln -s /usr/local/lib/libzipkin.so.0.5.2 /usr/local/lib/libzipkin.so.0 && \
     ln -s /usr/local/lib/libzipkin.so.0 /usr/local/lib/libzipkin.so && \
     ln -s /usr/local/lib/libzipkin_opentracing.so.0.5.2 /usr/local/lib/libzipkin_opentracing.so.0 && \
     ln -s /usr/local/lib/libzipkin_opentracing.so.0 /usr/local/lib/libzipkin_opentracing.so```

Actually, I am trying to do the same with DataDog and that doesn't seems to work for now.

@acj
Copy link

acj commented Nov 14, 2019

For anyone trying to use Datadog APM on Alpine, below is a sample Dockerfile loosely based on Yaytay's solution (thanks!). It should be straightforward to use with the nginx:*-alpine base images if you don't need to build nginx from source.

I followed Datadog's official directions for setting up nginx.conf. If memory serves, the only modification was to the shared object path:

opentracing_load_tracer /usr/local/lib64/libdd_opentracing.so /etc/dd-config.json;
Dockerfile
FROM alpine:3.10

WORKDIR /usr/src/app

ENV NGINX_VERSION="1.14.2"
ENV NGINX_OPENTRACING_VERSION="v0.9.0"
ENV NGINX_OPENTRACING_CPP_VERSION="v1.5.1"
ENV DATADOG_OPENTRACING_VERSION="v1.1.1"
ENV ZIPKIN_OPENTRACING_VERSION="v0.5.2"

ENV MAKEFLAGS="-j4"

RUN apk --update add tar build-base gcompat linux-headers pcre-dev zlib-dev gettext openssl-dev git cmake curl curl-dev msgpack-c-dev

RUN mkdir -p /usr/local/nginx/modules && \
    mkdir nginx && wget -q -O - http://nginx.org/download/nginx-1.14.2.tar.gz | tar xz -C nginx --strip-components=1 -f -

RUN cd /usr/src/app && \
    git clone -b $NGINX_OPENTRACING_CPP_VERSION https://github.com/opentracing/opentracing-cpp.git && \
    cd opentracing-cpp && \
    mkdir .build && cd .build && \
    cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF .. && \
    make && make install
RUN cd /usr/src/app && \
    git clone -b $DATADOG_OPENTRACING_VERSION https://github.com/DataDog/dd-opentracing-cpp && \
    cd dd-opentracing-cpp && \
    mkdir .build && cd .build && \
    cmake .. && \
    make && make install
RUN cd /usr/src/app && \
    git clone -b $ZIPKIN_OPENTRACING_VERSION https://github.com/rnburn/zipkin-cpp-opentracing.git && \
    cd zipkin-cpp-opentracing && \
    mkdir .build && cd .build && \
    cmake -DBUILD_SHARED_LIBS=1 -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF .. && \
    make && make install
RUN cd /usr/src/app && \
    git clone https://github.com/opentracing-contrib/nginx-opentracing.git

RUN cd /usr/src/app/nginx && \
    ./configure \
        --sbin-path=/usr/sbin/nginx \
        --conf-path=/usr/src/app/nginx.conf \
        --with-file-aio \
        --with-threads \
        --with-cc-opt="-O2" \
        --with-http_ssl_module \
        --with-compat \
        --add-dynamic-module=/usr/src/app/nginx-opentracing/opentracing && \
    make && make install

I'm still hoping to find a solution that uses the official releases from this repo, though, because building from source is slow and tends to be a maintenance headache. Will report back if I have any luck with it.

@Sund3
Copy link

Sund3 commented Dec 15, 2020

I managed to do with the jaeger client but only for version 0.4.2

@liuzheng
Copy link

RUN apk add gcompat

will solve this issue

I use this, will solve some lib issue

RUN apk add --no-cache --virtual .build-deps \
     gcompat libgcc libstdc++ pcre

but I have another problem

nginx: [error] Failed to load tracing library /usr/local/lib/libjaegertracing_plugin.so: Error relocating /usr/local/lib/libjaegertracing_plugin.so: __strftime_l: symbol not found

still finding solution

@liuzheng
Copy link

rebuild the jaeger-client-cpp with version 0.6.0 solved nginx error

@lucacome
Copy link
Member

lucacome commented Sep 28, 2021

We're now building Docker images for Alpine, does that help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants