docker file error for rm: unrecognized option '--silent'

Viewed 11

trying to build a docker file using gcloud command

gcloud --project $PROJECT builds submit --config=cloudbuild.yaml
--substitutions=_PROJECT_ID=$PROJECT,_REPOSITORY="gitlab-runner",_IMAGE="cloudcicd:latest" . and my docker file looks like this

FROM python:latest
 
# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive
 
#Versions
#ENV HELM_VERSION=v3.6.3
ENV KUBECTL_VERSION=v1.20.9
ENV MAVEN_OPTS="-Djavax.net.ssl.trustStore=/cicd/assets/truststore.jks"
ENV TERRAFORM_VERSION=1.2.0
ENV GOLANG_VERSION=1.18.6
ENV TERRAGRUNT_VERSION=v0.38.7
 
 
#Copy python requirements file
COPY requirements.txt /tmp/pip-tmp/
 
# Makes the Ansible directories
RUN mkdir /etc/ansible /ansible
RUN mkdir ~/.ssh
 
# Configure apt and install python packages
RUN apt-get update -y -q \
    && apt-get upgrade -y -q \
    && apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
    && apt-get install -y --no-install-recommends apt-utils \
    && apt-get -y install ca-certificates software-properties-common build-essential curl git gettext-base maven sshpass krb5-user \
    && pip --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \
    && apt-get -y install jq \
    && rm -rf /tmp/pip-tmp \
 
#Install helm
#RUN wget https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz \
#&& tar -zxvf helm-${HELM_VERSION}-linux-amd64.tar.gz \
#&& mv linux-amd64/helm /usr/local/bin/helm
 
#Install kubectl
RUN curl --silent https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl --output /usr/local/bin/kubectl \
&& chmod +x /usr/local/bin/kubectl
 
#Install Docker CLI
RUN curl -sSL https://get.docker.com/ | sh \
&& curl -L "https://github.com/docker/compose/releases/download/2.11.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose \
&& chmod +x /usr/local/bin/docker-compose
 
#Install AWS CLI
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \
&& unzip awscliv2.zip \
&& ./aws/install
 
#Copy Assets
RUN mkdir -p /cicd
COPY assets /cicd
 
#Install helm plugins
#RUN helm plugin install /cicd/helm-nexus-push
 
# Downloading gcloud package
RUN curl https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.tar.gz > /tmp/google-cloud-sdk.tar.gz
 
# Installing the package
RUN mkdir -p /usr/local/gcloud \
  && tar -C /usr/local/gcloud -xvf /tmp/google-cloud-sdk.tar.gz \
  && /usr/local/gcloud/google-cloud-sdk/install.sh
 
# Adding the package path to local
ENV PATH $PATH:/usr/local/gcloud/google-cloud-sdk/bin
 
RUN cd /tmp && \
    wget https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip && \
    unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d /usr/local/bin && \
    rm -rf /tmp/*
 
RUN cd /tmp && \
    wget  https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz && \
    tar -xzf go${GOLANG_VERSION}.linux-amd64.tar.gz -C /usr/local && \
    rm -rf /tmp/*
 
RUN cd /tmp && \
    wget https://github.com/gruntwork-io/terragrunt/releases/download/${TERRAGRUNT_VERSION}/terragrunt_linux_amd64 && \
    mv terragrunt_linux_amd64 /usr/local/bin/terragrunt && \
    chmod +x /usr/local/bin/terragrunt && \
    rm -rf /tmp/*
 
RUN git config --global http.sslCAinfo /etc/ssl/certs/ca-certificates.crt
 
ENV GOPATH=/usr/local/go
ENV PATH=/usr/local/go/bin:$PATH
ENV CGO_ENABLED=0
 
RUN go version
 
RUN terraform --version
 
RUN terragrunt --version
 
RUN ansible --version
 
CMD bash

and I get the following error

Reading state information...
The following additional packages will be installed:
  libjq1 libonig5
The following NEW packages will be installed:
  jq libjq1 libonig5
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 384 kB of archives.
After this operation, 1148 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bullseye/main amd64 libonig5 amd64 6.9.6-1.1 [185 kB]
Get:2 http://deb.debian.org/debian bullseye/main amd64 libjq1 amd64 1.6-2.1 [135 kB]
Get:3 http://deb.debian.org/debian bullseye/main amd64 jq amd64 1.6-2.1 [64.9 kB]
Fetched 384 kB in 0s (1621 kB/s)
Selecting previously unselected package libonig5:amd64.
(Reading database ... 28446 files and directories currently installed.)
Preparing to unpack .../libonig5_6.9.6-1.1_amd64.deb ...
Unpacking libonig5:amd64 (6.9.6-1.1) ...
Selecting previously unselected package libjq1:amd64.
Preparing to unpack .../libjq1_1.6-2.1_amd64.deb ...
Unpacking libjq1:amd64 (1.6-2.1) ...
Selecting previously unselected package jq.
Preparing to unpack .../archives/jq_1.6-2.1_amd64.deb ...
Unpacking jq (1.6-2.1) ...
Setting up libonig5:amd64 (6.9.6-1.1) ...
Setting up libjq1:amd64 (1.6-2.1) ...
Setting up jq (1.6-2.1) ...
Processing triggers for libc-bin (2.31-13+deb11u4) ...
rm: unrecognized option '--silent'
Try 'rm --help' for more information.
The command '/bin/sh -c apt-get update -y -q     && apt-get upgrade -y -q     && apt-get -y install --no-install-recommends apt-utils dialog 2>&1     && apt-get install -y --no-install-recommends apt-utils     && apt-get -y install ca-certificates software-properties-common build-essential curl git gettext-base maven sshpass krb5-user     && pip --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt     && apt-get -y install jq     && rm -rf /tmp/pip-tmp RUN curl --silent https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl --output /usr/local/bin/kubectl && chmod +x /usr/local/bin/kubectl' returned a non-zero code: 1
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/docker" failed: step exited with non-zero status: 1

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

BUILD FAILURE: Build step failure: build step 0 "gcr.io/cloud-builders/docker" failed: step exited with non-zero status: 1
ERROR: (gcloud.builds.submit) build 46bc93d2-9bbf-4de2-96db-8312f9b06843 completed with status "FAILURE"

im trying to push the docker file google artifact registry

0 Answers
Related