2

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 ./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 found I 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 found

What am I doing wrong? How can I extract and run the executable, or otherwise install azcopy in my gitlab CI/CD script

1

This is a glibc dependency issue on Alpine.

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-compat
-1

After doing the extract you should set it executable with chmod +x azcopy

You can then run it with a azcopy --help

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.