Sh:./탄력-에이전트:을 발견하지 않을 실행하려고 할 때는 탄력에 에이전트 알파인 리눅스

0

질문

나를 구성하려고 하는 탄력에 에이전트 docker 컨테이너를 다른 서비스입니다. 컨테이너에 따라 알파인 리눅스,아직 내가 실행할 수 없는 탄력적인 에이전트 명령어 다운로드 후 추출하고 에이전트:그것에 대해 불평을"찾을 수 없습니다"파일을 파일이 실제로 존재!

여기에는 최소 예 reproductible

docker run --rm -it alpine sh
# cd /opt
# wget https://artifacts.elastic.co/downloads/beats/elastic-agent/elastic-agent-7.14.2-linux-x86_64.tar.gz
# tar xvf elastic-agent-7.14.2-linux-x86_64.tar.gz
# cd elastic-agent-7.14.2-linux-x86_64/
# ./elastic-agent
sh: ./elastic-agent: not found
# ls -la
total 8452
drwxr-xr-x    3 root     root          4096 Nov 18 17:38 .
drwxr-xr-x    1 root     root          4096 Nov 18 17:38 ..
-rw-r--r--    1 root     root            41 Sep 15 17:00 .build_hash.txt
-rw-r--r--    1 root     root            41 Sep 15 17:00 .elastic-agent.active.commit
-rw-r--r--    1 root     root         13675 Sep 15 16:54 LICENSE.txt
-rw-r--r--    1 root     root       8586842 Sep 15 16:54 NOTICE.txt
-rw-r--r--    1 root     root           866 Sep 15 17:00 README.md
drwxr-xr-x    3 root     root          4096 Nov 18 17:38 data
lrwxrwxrwx    1 root     root            39 Nov 18 17:38 elastic-agent -> data/elastic-agent-574c21/elastic-agent
-rw-r--r--    1 root     root          9020 Sep 15 16:55 elastic-agent.reference.yml
-rw-------    1 root     root          9017 Sep 15 16:55 elastic-agent.yml
# ./data/elastic-agent-574c21/elastic-agent
sh: ./data/elastic-agent-574c21/elastic-agent: not found

에서 실행하는 x86_64 로 호스트와 함께 볼 수 있는 커널 버전이나 패키지 repos:

# uname -a
Linux 59ae07b0dca8 5.10.47-linuxkit #1 SMP Sat Jul 3 21:51:47 UTC 2021 x86_64 Linux
# apk update
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz
v3.14.3-14-g9234faeb0d [https://dl-cdn.alpinelinux.org/alpine/v3.14/main]
v3.14.3-12-g13e0706e2c [https://dl-cdn.alpinelinux.org/alpine/v3.14/community]
OK: 14942 distinct packages available

에서 보는 바이너리할 수 있는 링크 라이브러리를 올바르게:

# ldd  ./data/elastic-agent-574c21/elastic-agent
    /lib64/ld-linux-x86-64.so.2 (0x7f1868c2f000)
    libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7f1868c2f000)
    libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7f1868c2f000)
    libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f1868c2f000)

그것은 또한 그것을 실행할 수 있는 권한이

# ls -la /usr/local/bin/elastic-agent-7.14.2-linux-x86_64/data/elastic-agent-574c21/
total 57244
drwxr-xr-x    3 root     root          4096 Nov 18 17:38 .
drwxr-xr-x    3 root     root          4096 Nov 18 17:38 ..
drwxr-xr-x    2 root     root          4096 Nov 18 17:38 downloads
-rwxr-xr-x    1 root     root      58603536 Sep 15 17:00 elastic-agent

strace 하지 않는 것을 돕도

# strace -f ./elastic-agent
execve("./elastic-agent", ["./elastic-agent"], 0x7fff9e17bee8 /* 7 vars */) = -1 ENOENT (No such file or directory)
strace: exec: No such file or directory
+++ exited with 1 +++

나는 뭔가? 수산을 방지하는 바이너리에서 시작에서 몇 가지 조건이 있습니까?

당신의 도움을 주셔서 감사합니다!

alpine docker elastic-stack
2021-11-18 17:55:09
1

최고의 응답

2

문제는 것 같이 컴파일된 버전의 elastic-agent 다운로드가 필요합 libc. 알파인 리눅스를 사용 muslc.

나 설치 glibc 에서 사용하여 알파인 https://stackoverflow.com/a/38433396/5666087. 다음 elastic-agent 가 나타납니다.

FROM alpine
WORKDIR /opt
RUN wget -qO - https://artifacts.elastic.co/downloads/beats/elastic-agent/elastic-agent-7.14.2-linux-x86_64.tar.gz \
    | tar xz
# Add glibc
RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub \
    && wget -q https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.28-r0/glibc-2.28-r0.apk \
    && apk add glibc-2.28-r0.apk \
    && rm glibc-2.28-r0.apk

실행 결과 이미지(가정하자 그것은 이름 elastic):

docker run --rm -it elastic /opt/elastic-agent-7.14.2-linux-x86_64/elastic-agent
2021-11-18 18:48:38

는 해결합니다. 나는 배운 다른 일에 대한 기본 라이브러리 리눅스의 오늘입니다.
Thomas P.

다른 언어로

이 페이지는 다른 언어로되어 있습니다

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................