dockerdockerfiledebiangitlab-cikaniko

readlink: unrecognized option: m


I have the following Dockerfile.

FROM debian:10.7

ARG DEBIAN_FRONTEND=noninteractive

RUN echo "Acquire::http::Proxy \"${HTTP_PROXY}\";" >> /etc/apt/apt.conf.d/50proxy && echo "Acquire::https::Proxy \"${HTTPS_PROXY}\";" >> /etc/apt/apt.conf.d/50proxy

# Install coreutils, dialog, apt-utils since busybox seems to lack them
RUN apt-get update && apt-get install -y coreutils diffutils dialog apt-utils

# Update openssl to the latest version
RUN apt-get update && apt-get upgrade -y openssl

# installing jq and envsubst binary, very useful for shell templating
RUN apt-get update && apt-get install -y --no-install-recommends \
    libc6=2.28-10+deb10u2 \
    && apt-get upgrade -y && apt-get install -y jq bash gettext-base openssl ca-certificates && rm -rf /var/lib/apt/lists/*


RUN ls -alt /usr/local/share/ca-certificates/ \
    && echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \
    && ls -alt /etc/ssl/certs/

RUN update-ca-certificates

RUN echo YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY \
    && ls -alt /etc/ssl/certs/

RUN echo "export http_proxy=${HTTP_PROXY}" >> /etc/profile.d/proxy.sh && echo "export https_proxy=${HTTPS_PROXY}" >> /etc/profile.d/proxy.sh && echo "export no_proxy=${NO_PROXY}" >> /etc/profile.d/proxy.sh

# Add Tini
COPY files/tini-amd64-0.17.0 /sbin/tini

# Force the installation of the package maintainer's version of the openssl.cnf file
RUN echo 'openssl openssl/cnf note' | debconf-set-selections && \
    apt-get install -y --no-install-recommends openssl=1.1.1d-0+deb10u7 --reinstall -o Dpkg::Options::="--force-confnew"

I have installed the coreutils, diffutils packages thinkin it was missing something from there but I stil get the same issue.

readlink: unrecognized option: m
BusyBox v1.33.1 () multi-call binary.
Usage: readlink [-fnv] FILE
Display the value of a symlink
    -f  Canonicalize by following all symlinks
    -n  Don't add newline
    -v  Verbose
dpkg: error processing archive /var/cache/apt/archives/libc6_2.28-10+deb10u2_amd64.deb (--unpack):
 new libc6:amd64 package pre-installation script subprocess returned error exit status 1

From what I can see and found on the internet -m option does not exist in this version. I have tried some other things but I cannot change to use -f or something else.

Any leads on ho to make this work?


Solution

  • I found the solution. At first it did not pull the correct image and I just needed to install coreutils since it seems Busybox uses a more tonedown version of readlink.

    After installing coreutils and executing in the container I could confirm that the readlink -m option was there.

    FROM debian:10.7
    
    ENV DEBIAN_FRONTEND=noninteractive
    
    RUN echo "Acquire::http::Proxy \"${HTTP_PROXY}\";" >> /etc/apt/apt.conf.d/50proxy && echo "Acquire::https::Proxy \"${HTTPS_PROXY}\";" >> /etc/apt/apt.conf.d/50proxy
    # installing jq and envsubst binary, very usefull for shell templating
    RUN apt-get update && apt-get upgrade -y && apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install -y jq bash gettext-base ca-certificates coreutils && rm -rf /var/lib/apt/lists/*
    
    COPY certs/* /usr/local/share/ca-certificates/
    RUN update-ca-certificates
    RUN echo "export http_proxy=${HTTP_PROXY}" >> /etc/profile.d/proxy.sh && echo "export https_proxy=${HTTPS_PROXY}" >> /etc/profile.d/proxy.sh && echo "export no_proxy=${NO_PROXY}" >> /etc/profile.d/proxy.sh
    
    # Add Tini
    COPY files/tini-amd64-0.17.0 /sbin/tini
    

    This is the updated Dockerfile, maybe it helps some others with similar issues.