Hi, I was workign in a project with CI/CD and after 5 months of inactivity I upload some modification and the pipeline started but failed.
I got this error:
error during connect: Post http://docker:2375/v1.40/auth: dial tcp: lookup docker on 169.254.169.254:53: no such host
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1
I never changed the code of my pipeline and now Im getting this nasty error
Im using gitlab.com with the free usage_quota, with 1% usage this month.
This is my gitlab-ci.yml:
stages:
- build
- publish
#BUILD DEVELOPMENT
build_development:
image: docker:stable
services:
- docker:dind
variables:
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
#branches su cui eseguire lo scriptino
rules:
- if: $CI_COMMIT_REF_NAME == "development"
stage: build
#Se pipeline invocata da altro branch
script:
# ADD GOOGLE SERVICE KEY
- echo "${GCLOUD_SERVICE_KEY}" > ${HOME}/gcloud-service-key.json
#Per muovermi nelle cartelle nel git mi muovo con questo comando
- cd MyProjectAPI
# BUILD AND UPLOAD TO GOOGLE REPO IMAGES
- docker login -u _json_key --password-stdin https://eu.gcr.io < ${HOME}/gcloud-service-key.json
- docker build --tag $IMAGE_DEVELOPMENT_NAME -f Dockerfile . #the . means build the image from within the build context
- docker tag $IMAGE_DEVELOPMENT_NAME "eu.gcr.io/$GCLOUD_PROJECT_ID/$IMAGE_DEVELOPMENT_NAME"
- docker push "eu.gcr.io/$GCLOUD_PROJECT_ID/$IMAGE_DEVELOPMENT_NAME:latest"
This is my Dockerfile:
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /app
EXPOSE 8080
# Install production dependencies.
# Copy csproj and restore as distinct layers.
COPY . ./
RUN dotnet restore
# Copy local code to the container image.
# Build a release artifact.
RUN dotnet publish -c Release -o out
# Use Microsoft's official runtime .NET image.
# https://hub.docker.com/_/microsoft-dotnet-core-aspnet/
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS runtime
# Install System.Drawing native dependencies on ASP.NET
RUN apt-get update \
&& apt-get install -y --allow-unauthenticated \
libc6-dev \
libgdiplus \
libx11-dev \
libfontconfig1 \
&& rm -rf /var/lib/apt/lists/*
COPY --from=build /app/out ./
# Run the web service on container startup.
ENTRYPOINT ["dotnet", "MyProjectAPI.dll"]
The yaml file is in the root of the project, meanwhile the Dockerfile is inside the project folder.
This code worked for 2 years and now It doesnt.
Thanks everybody and hope somebody knows how to fix it.
I already read a lot of post here in tforum but they are all old