Home > Mobile >  404 error for some packages when building docker image
404 error for some packages when building docker image

Time:12-31

when building docker image for gitlab runner base image getting error as :

ERRO[2021-12-29T09:46:32Z] Application execution failed                  PID=6622 error="executing the script on the remote host: executing script on container with IP \"3.x.x.x\": connecting to server: connecting to server \"3.x.x.x:x\" as user \"root\": dial tcp 3.x.x.x:x: connect: connection refused"
ERROR: Job failed (system failure): prepare environment: exit status 2. Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information

Dockerfile:

FROM registry.gitlab.com/tmaczukin-test-projects/fargate-driver-debian:latest
RUN apt-get install -y wget && \
    apt-get install -y python3-pip && \
    wget https://releases.hashicorp.com/terraform/0.12.24/terraform_0.12.24_linux_amd64.zip && \
    unzip terraform_0.12.24_linux_amd64.zip
    mv terraform /usr/local/bin && \
    chmod -R 777 /usr/local/bin

CodePudding user response:

I'm assuming the error mentioned in the title is from the apt-get install commands. You should be running an apt-get update first to get an updated package list. Otherwise apt will be looking for packages from a stale state (whenever the base image was created). You can also merge the install commands and include a cleanup of temporary files in the same step to reduce layer size.

FROM registry.gitlab.com/tmaczukin-test-projects/fargate-driver-debian:latest
RUN apt-get update && \
    apt-get install -y \
      python3-pip \
      wget && \
    wget https://releases.hashicorp.com/terraform/0.12.24/terraform_0.12.24_linux_amd64.zip && \
    unzip terraform_0.12.24_linux_amd64.zip
    mv terraform /usr/local/bin && \
    chmod -R 777 /usr/local/bin && \
    rm terraform_0.12.24_linux_amd64.zip && \
    rm -rf /var/lib/apt/lists/*
  • Related