title: Running geckodriver in an Alpine docker container
body: <p>I'm trying to run GeckoDriver v0.26.0 inside an Alpine 3.10 docker container, specifically <code>python:3.6.6-alpine3.10</code>.</p>
  
  <p>After figuring some things out, I've hit a wall:</p>
  
  <pre><code>/ # geckodriver --version
  Error relocating /usr/bin/geckodriver: __register_atfork: symbol not found
  Error relocating /usr/bin/geckodriver: __res_init: symbol not found
  </code></pre>
  
  <p>What am I missing?</p>
  
  <h2>How I got here</h2>
  
  <p>First spin up the docker container:</p>
  
  <pre><code>docker run -it python:3.6.9-alpine3.10 /bin/sh
  </code></pre>
  
  <p>Then try installing GeckoDriver</p>
  
  <pre><code>/ # wget https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz
  / # tar -zxf geckodriver-v0.26.0-linux64.tar.gz -C /usr/bin
  / # geckodriver --version
  /bin/sh: geckodriver: not found.
  </code></pre>
  
  <p>Really? but I just extracted it... Hmm... OK. Did it extract correctly? Is <code>$PATH</code> correct?</p>
  
  <pre><code>/ # ls -lah /usr/bin/geckodriver
  -rwxr-xr-x    1 1000     1000        6.7M Oct 12 10:19 /usr/bin/geckodriver
  / # echo $PATH
  /usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
  </code></pre>
  
  <p>Yes. OK, Let's google things. Well perhaps I should <a href="https://unix.stackexchange.com/q/378301/62799">check the <code>file</code> info</a>. Alpine doesn't have that by default.</p>
  
  <pre><code>/ # apk add file
  fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/main/x86_64/APKINDEX.tar.gz
  fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/community/x86_64/APKINDEX.tar.gz
  (1/2) Installing libmagic (5.37-r1)
  (2/2) Installing file (5.37-r1)
  Executing busybox-1.30.1-r2.trigger
  OK: 24 MiB in 36 packages
  / # file /usr/bin/geckodriver
  /usr/bin/geckodriver: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.26, BuildID[sha1]=32c4cfc2d9346336dc7c20e99a62df9be344d609, with debug_info, not stripped
  </code></pre>
  
  <p>The <a href="https://unix.stackexchange.com/a/379072/62799">answer to that same question</a> says to check for <code>/lib64/ld-linux-x86-64.so.2</code>:</p>
  
  <pre><code>/ # ls /lib64
  ls: /lib64: No such file or directory
  </code></pre>
  
  <p>Missing. OK, how do we get that? The <a href="https://pkgs.alpinelinux.org/contents?file=ld-linux-x86-64.so.2&amp;path=&amp;name=&amp;branch=v3.10" rel="noreferrer">Alpine package repo</a> says it's part of <code>libc6-compat</code>. Cool install that and things will work... right?</p>
  
  <pre><code>/ # apk add libc6-compat
  (1/1) Installing libc6-compat (1.1.22-r3)
  OK: 24 MiB in 37 packages
  / # ls /lib64
  ld-linux-x86-64.so.2
  / # geckodriver --version
  Error loading shared library libgcc_s.so.1: No such file or directory (needed by /usr/bin/geckodriver)
  Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /usr/bin/geckodriver)
  Error relocating /usr/bin/geckodriver: __register_atfork: symbol not found
  Error relocating /usr/bin/geckodriver: _Unwind_Resume: symbol not found
  Error relocating /usr/bin/geckodriver: __res_init: symbol not found
  Error relocating /usr/bin/geckodriver: _Unwind_GetIP: symbol not found
  Error relocating /usr/bin/geckodriver: _Unwind_Backtrace: symbol not found
  </code></pre>
  
  <p>... Well at least it recognizes it as an executable file now... OK, so we need <code>libgcc_s.so.1</code>. <a href="https://pkgs.alpinelinux.org/contents?file=libgcc_s.so.1&amp;path=&amp;name=&amp;branch=v3.10" rel="noreferrer">That's in libgcc</a>. Makes sense.</p>
  
  <pre><code>/ # apk add libgcc
  (1/1) Installing libgcc (8.3.0-r0)
  OK: 24 MiB in 38 packages
  / # geckodriver --version
  Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /usr/bin/geckodriver)
  Error relocating /usr/bin/geckodriver: __register_atfork: symbol not found
  Error relocating /usr/bin/geckodriver: __res_init: symbol not found
  </code></pre>
  
  <p>What? We have <code>ld-linux-x86-64.so.2</code> in <code>/lib64</code>, where's it looking? I did notice that the <code>gcompat</code> package as <code>/lib/ld-linux-x86-64.so.2</code>, maybe it's looking there?</p>
  
  <pre><code># / apk add gcompat
  (1/2) Installing libucontext (0.1.3-r1)
  (2/2) Installing gcompat (0.4.0-r0)
  OK: 24 MiB in 40 packages
  # / geckodriver --version
  Error relocating /usr/bin/geckodriver: __register_atfork: symbol not found
  Error relocating /usr/bin/geckodriver: __res_init: symbol not found
  </code></pre>
  
  <p>And that's where I'm at. Googling for <code>__register_atfork</code> and <code>__res_init</code> don't return anything useful.</p>