Running geckodriver in an Alpine docker container

后端 未结 1 1403
一向
一向 2020-12-18 03:51

I\'m trying to run GeckoDriver v0.26.0 inside an Alpine 3.10 docker container, specifically python:3.6.6-alpine3.10.

After figuring some things out, I\'

相关标签:
1条回答
  • 2020-12-18 04:26

    So the root cause of the issue appears to be that Alpine uses musl libc and GeckoDriver (indirectly) uses glibc.

    SGerrand has a great glibc compatibility layer package for Alpine Linux which we'll make use of.

    To get GeckoDriver running on Alpine:

    # Get all the prereqs
    wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
    wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.30-r0/glibc-2.30-r0.apk
    wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.30-r0/glibc-bin-2.30-r0.apk
    apk add glibc-2.30-r0.apk
    apk add glibc-bin-2.30-r0.apk
    
    # And of course we need Firefox if we actually want to *use* GeckoDriver
    apk add firefox-esr=60.9.0-r0
    
    # Then install GeckoDriver
    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
    

    Caveats:

    • Only tested on the python:3.6.9-alpine3.10 docker image.
    • Alpine 3.10 only has Firefox ESR 60. Luckily GeckoDriver v0.26 has a minimum version of FireFox 60.
      • The Alpine Edge branch has Firefox-ESR 86 and Firefox 70.
    0 讨论(0)
提交回复
热议问题