Search code examples
linuxdockerdiffalpine-linuxbusybox

Alpine 3.11 diff: unrecognized option: c BusyBox v1.31.1 () multi-call binary


I am using an alpine 3.11 to build my image, everything goes well during the build the dockefile is here below :

FROM alpine:3.11
LABEL version="1.0"
ARG UID="110"

ARG PYTHON_VERSION="3.8.10-r0"
ARG ANSIBLE_VERSION="5.0.1"
ARG AWSCLI_VERSION="1.22.56"
  
  # Create jenkins user with sudo privileges
RUN adduser -u ${UID} -D -h /home/jenkins/ jenkins
RUN echo 'jenkins ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
RUN mkdir -p /tmp/.ansible
RUN chown -R jenkins:jenkins /tmp/.ansible
  
  # Install minimal packages
RUN apk --update --no-cache add bash bind-tools curl gcc git libffi-dev libpq make mysql-client openssl postgresql-client sudo unzip wget coreutils
  #RUN apk --update --no-cache add py-mysqldb
RUN apk --update --no-cache add python3=${PYTHON_VERSION} python3-dev py3-pip py3-cryptography
  
  # Install JQ from sources
RUN wget https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64
RUN mv jq-linux64 /usr/bin/jq
RUN chmod +x /usr/bin/jq
  # Install ansible and awscli with python package manager
RUN pip3 install --upgrade pip
RUN pip3 install yq --ignore-installed PyYAML
RUN pip3 install ansible==${ANSIBLE_VERSION}
RUN pip3 install awscli==${AWSCLI_VERSION} boto boto3 botocore s3cmd pywinrm pymysql 'python-dateutil<2.8.1'
  # Clean cache
RUN rm -rf /var/cache/apk/*
  # Display packages versions
RUN python3 --version && \
pip3 --version && \
ansible --version && \
aws --version

this image is later used to lunch some jenkins jobs nothing unusual.

But when i try to use the diff command in of these jobs I have the following error :

diff: unrecognized option: c  BusyBox v1.31.1 () multi-call binary

that's why i tried to install the coreutils package but still the "-c" option is still unrecognized which is weird.

So my question is there a way to add the -c option for the diff command because in the manual of GNU this should be available automatically but apparently not on Alpine ? if there is a way could anyone please share it.

P.S : In case you are wondering why am I using the diff command it is just to compare two json files and the -c is necessary for me in this context.


Solution

  • Well I just had to add the diffutils package to the list after installing it everything works well