patterndockerModerate
Installing azcopy in Gitlab Runner (Alpine Linux)
Viewed 0 times
alpinegitlabrunnerinstallinglinuxazcopy
Problem
How can I install azcopy and use it in my gitlab runner CI/CD script?
First I have two scripts that download the tar file and extract it.
However, if I try running executable
I know this directory/file exists because I've ran
I've also tried copying the binary to
What am I doing wrong? How can I extract and run the executable, or otherwise install azcopy in my gitlab CI/CD script
First I have two scripts that download the tar file and extract it.
- wget -O azcopy.tar.gz https://aka.ms/downloadazcopy-v10-linux
- tar -xf azcopy.tar.gz
However, if I try running executable
./azcopy_linux_amd64_10.1.0/azcopy I get an error saying /bin/sh: eval: line 102: ./azcopy_linux_amd64_10.1.0/azcopy: not foundI know this directory/file exists because I've ran
ls commands.I've also tried copying the binary to
/usr/bin and/or /usr/local/bin but I still get the error: /bin/sh: eval: line 102: azcopy: not foundWhat am I doing wrong? How can I extract and run the executable, or otherwise install azcopy in my gitlab CI/CD script
Solution
This is a glibc dependency issue on Alpine.
This
You could verify by running
Note the
Fortunately, Alpine provides a light compatibility layer for glibc, through the libc6-compat package. It installs a
Therefore, for running azcopy on Alpine, just install the
This
azcopy binary is compatible with Linux distributions that use glibc, GNU's C standard library. Alpine Linux uses a different libc implementation, musl-libc, which is generally not compatible to glibc. When trying to run non-Alpine-built binaries on Alpine, they'll usually fail to link since the glibc shared object, libc.so.6, is missing. azcopy: not found is actually the result of the dynamic linker failing to resolve the requires libraries.You could verify by running
ldd ./azcopy:/lib64/ld-linux-x86-64.so.2 (0x7fa0bc9c3000)
libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7fa0bc9c3000)
libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7fa0bc9c3000)Note the
libc.so.6 dependency. On vanilla Alpine, there's only the musl libc binary, libc.musl-x86_64.so.1.Fortunately, Alpine provides a light compatibility layer for glibc, through the libc6-compat package. It installs a
libc.so.6 link which is redirected to the musl shared object, and adds some missing glibc interface functions. This seems to be enough to running azcopy.Therefore, for running azcopy on Alpine, just install the
libc6-compat package, using: apk add libc6-compatCode Snippets
/lib64/ld-linux-x86-64.so.2 (0x7fa0bc9c3000)
libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7fa0bc9c3000)
libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7fa0bc9c3000)apk add libc6-compatContext
StackExchange DevOps Q#7955, answer score: 11
Revisions (0)
No revisions yet.