skip to Main Content

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?

2

Answers


  1. Chosen as BEST ANSWER

    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.


  2. Thank you for sharing your solution @Stefan. I guess we had a similar issue but different setup (?). I am using a custom Kaniko image so I can add other tools like jq using the Dockerfile below:

    FROM gcr.io/kaniko-project/executor:v1.9.0-debug AS kaniko
    FROM alpine:3.14.2
    
    RUN apk --update add 
      bash 
      jq
    
    COPY --from=kaniko /kaniko/warmer /kaniko/
    COPY --from=kaniko /kaniko/executor /kaniko/
    COPY --from=kaniko /kaniko/ssl /kaniko/
    COPY --from=kaniko /kaniko/docker-credential-ecr-login /kaniko/
    COPY --from=busybox:1.32.0 /bin /busybox
    
    ENV PATH $PATH:/usr/local/bin:/kaniko:/busybox
    ENV DOCKER_CONFIG /kaniko/.docker/
    

    I then used the built image to build my application but it keeps failing with the readlink: unrecognized option: m error.

    Adding coreutils to the custom kaniko Dockerfile fixed the issue for me.

    ...
    RUN apk --update add 
      coreutils 
      bash 
      jq
    ...
    

    And I guess busybox is not needed anymore with coreutils added?

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search