Answers: <p>This is a glibc dependency issue on Alpine.</p>
  
  <p>This <code>azcopy</code> binary is compatible with Linux distributions that use <a href="https://www.gnu.org/software/libc" rel="noreferrer">glibc</a>, GNU's C standard library. Alpine Linux uses a different libc implementation, <a href="https://www.musl-libc.org/" rel="noreferrer">musl-libc</a>, 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, <code>libc.so.6</code>, is missing. <code>azcopy: not found</code> is actually the result of the dynamic linker failing to resolve the requires libraries.</p>
  
  <p>You could verify by running <code>ldd ./azcopy</code>:</p>
  
  <pre><code>    /lib64/ld-linux-x86-64.so.2 (0x7fa0bc9c3000)
      libpthread.so.0 =&gt; /lib64/ld-linux-x86-64.so.2 (0x7fa0bc9c3000)
      libc.so.6 =&gt; /lib64/ld-linux-x86-64.so.2 (0x7fa0bc9c3000)
  </code></pre>
  
  <p>Note the <code>libc.so.6</code> dependency. On vanilla Alpine, there's only the musl libc binary, <code>libc.musl-x86_64.so.1</code>.</p>
  
  <p>Fortunately, Alpine provides a light compatibility layer for glibc, through the <a href="https://pkgs.alpinelinux.org/package/v3.9/main/x86/libc6-compat" rel="noreferrer">libc6-compat</a> package. It installs a <code>libc.so.6</code> link which is redirected to the musl shared object, and adds some missing glibc interface functions. This seems to be enough to running azcopy.</p>
  
  <p>Therefore, for running azcopy on Alpine, just install the <code>libc6-compat</code> package, using: </p>
  
  <pre><code>apk add libc6-compat
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2019-05-03T06:22:11.110Z
Answers: 2019-05-03T06:22:11.110Z
Answers: valiano
Answers: <p>After doing the extract you should set it executable with <code>chmod +x azcopy</code></p>
  
  <p>You can then run it with a <code>azcopy --help</code></p>
  
Answers: CC BY-SA 4.0
Answers: 2019-04-28T00:54:52.573Z
Answers: 2019-04-28T00:54:52.573Z
Answers: Matthieu Ducorps
Body: <p>How can I install <a href="https://docs.microsoft.com/en-us/azure/storage/common/storage-use-azcopy-linux" rel="noreferrer">azcopy</a> and use it in my gitlab runner CI/CD script?</p>
  
  <p>First I have two scripts that download the tar file and extract it.</p>
  
  <ul>
  <li>wget -O azcopy.tar.gz <a href="https://aka.ms/downloadazcopy-v10-linux" rel="noreferrer">https://aka.ms/downloadazcopy-v10-linux</a></li>
  <li>tar -xf azcopy.tar.gz</li>
  </ul>
  
  <p>However, if I try running executable <code>./azcopy_linux_amd64_10.1.0/azcopy</code> I get an error saying <code>/bin/sh: eval: line 102: ./azcopy_linux_amd64_10.1.0/azcopy: not found</code>
  I know this directory/file exists because I've ran <code>ls</code> commands.</p>
  
  <p>I've also tried copying the binary to <code>/usr/bin</code> and/or <code>/usr/local/bin</code> but I still get the error: <code>/bin/sh: eval: line 102: azcopy: not found</code></p>
  
  <p>What am I doing wrong? How can I extract and run the executable, or otherwise install azcopy in my gitlab CI/CD script</p>
  
Tags: <docker><gitlab-ci-runner><alpine>
Title: Installing azcopy in Gitlab Runner (Alpine Linux)
UserDisplayName: Brad
ThreadText: # Installing azcopy in Gitlab Runner (Alpine Linux)
  
  (Asked by: username_0 on 2019-04-25)
  
  How can I install [azcopy](https://docs.microsoft.com/en-us/azure/storage/common/storage-use-azcopy-linux) and use it in my gitlab runner 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 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
  
  **Tags:** docker, gitlab-ci-runner, alpine
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2019-05-03. Score: 11
  
  This is a glibc dependency issue on Alpine.
  
  This `azcopy` binary is compatible with Linux distributions that use [glibc](https://www.gnu.org/software/libc), GNU's C standard library. Alpine Linux uses a different libc implementation, [musl-libc](https://www.musl-libc.org/), 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](https://pkgs.alpinelinux.org/package/v3.9/main/x86/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
  
  ```
  
  
  ---
  
  ### Answer by username_2 on 2019-04-28. Score: -1
  
  After doing the extract you should set it executable with `chmod +x azcopy`
  
  You can then run it with a `azcopy --help`
  
  
  ---
  
  