Error cannot find -lz building MariaDB on a debian based container

I’m trying to build MariaDB on a Debian based container. But it cannot find a z library.

Here is the container image script:

  • Use nginx as proxy with docker
  • What's the best way to synchronize a python script with a docker database container?
  • Jenkins getting test results from docker slave
  • Unable to pull the images in docker on Windows
  • How to cache downloaded dependencies for a Jenkins Docker SSH Slave (Gradle)
  • /bin/sh: 1: python: not found while running docker container
  • FROM debian
    RUN apt-get update
    RUN apt-get install -y libncurses-dev
    RUN apt-get install -y build-essential;
    RUN apt-get install -y cmake;
    COPY mariadb-10.1.18.tar.gz /usr/bin/
    WORKDIR /usr/bin/
    RUN gzip -d mariadb-10.1.18.tar.gz
    RUN tar -xvf mariadb-10.1.18.tar
    RUN ln -s mariadb-10.1.18 mariadb
    WORKDIR /usr/bin/mariadb/
    RUN mkdir install; mkdir install/data; mkdir install/var; mkdir install/etc; mkdir install/tmp
    RUN cd /usr/bin/mariadb/;
    RUN rm -f CMakeCache.txt;
    RUN cmake \
      -DCMAKE_INSTALL_PREFIX=/usr/bin/mariadb/install \
      -DMYSQL_DATADIR=/usr/bin/mariadb/install/data \
      -DWITH_BOOST=/usr/bin/mariadb/install/boost \

    And the console output:

    [ 77%] Building CXX object storage/tokudb/PerconaFT/ft/CMakeFiles/ft.dir/
    Linking CXX shared library
    /usr/bin/ld: cannot find -lz
    collect2: error: ld returned 1 exit status
    storage/tokudb/PerconaFT/ft/CMakeFiles/ft.dir/build.make:1323: recipe for target 'storage/tokudb/PerconaFT/ft/' failed
    make[2]: *** [storage/tokudb/PerconaFT/ft/] Error 1
    CMakeFiles/Makefile2:3438: recipe for target 'storage/tokudb/PerconaFT/ft/CMakeFiles/ft.dir/all' failed
    make[1]: *** [storage/tokudb/PerconaFT/ft/CMakeFiles/ft.dir/all] Error 2
    Makefile:147: recipe for target 'all' failed
    make: *** [all] Error 2
    The command '/bin/sh -c make' returned a non-zero code: 2

  • Multiple storage drivers panic in private registry
  • Why >>> eval “$(docker-machine env default)” in a ansible playbook script return “No such file or directory”
  • pass cookie from http response via nginx proxy
  • FATA[0000] Get http:///var/run/docker.sock/v1.17/version: dial unix /var/run/docker.sock
  • Silently Installing pecl modules (e.g. pecl_http) Inside a Docker Container?
  • Docker Error: CSS File in Mapped Volume Fails to Update
  • One Solution collect form web for “Error cannot find -lz building MariaDB on a debian based container”

    either change the container script and specify CMake parameter -DWITH_ZLIB=bundled to use zlib sources in extra/zlib or install zlib by apt-get install zlib-devel

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.