Assuming you are using the official PHP Docker image...
# ---------------------------------------------------------------
# PHP Extension: Gearman
# Download Gearman PECL extension for Gearman supporting PHP 7
RUN apt-get -y --allow-unauthenticated install \
libgearman-dev
RUN cd /tmp \
&& git clone https://github.com/wcgallego/pecl-gearman.git \