Search code examples
amazon-web-servicesdockerfile

docker build fails with Exit code 28


I'm going through the TestDriven.io tutorial "Scalable FastAPI Applications on AWS" in the "Deployment" chapter:

https://testdriven.io/courses/scalable-fastapi-aws/deployment/

I've just created the Docker image file for building and pushing a Docker image for the application. When I commit the code and the pipeline runs, it fails on the Dockerfiles first RUN command, which just installs AWS CLI, Python and Poetry. The result is "ERROR: Job failed: exit code 28".

The command in the Dockerfile that fails is:

    RUN apk --no-cache add \
            binutils \
            curl \
        && curl -sL https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub -o /etc/apk/keys/sgerrand.rsa.pub \
        && curl -sLO https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-${GLIBC_VER}.apk \
        && curl -sLO https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-bin-${GLIBC_VER}.apk \
        && apk add --no-cache \
            glibc-${GLIBC_VER}.apk \
            glibc-bin-${GLIBC_VER}.apk \
        && curl -sL https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -o awscliv2.zip \
        && unzip awscliv2.zip \
        && aws/install \
        && rm -rf \
            awscliv2.zip \
            aws \
            /usr/local/aws-cli/v2/*/dist/aws_completer \
            /usr/local/aws-cli/v2/*/dist/awscli/data/ac.index \
            /usr/local/aws-cli/v2/*/dist/awscli/examples \
        && apk --no-cache del \
            binutils \
            curl \
        && rm glibc-${GLIBC_VER}.apk \
        && rm glibc-bin-${GLIBC_VER}.apk \
        && rm -rf /var/cache/apk/*

I've found a few different results just by googling "Exit code 28" but I'm not sure which one applies and how to fix this. Has anyone else done this tutorial, and can provide some insight?


Solution

  • Exit code 28 in curl means "Operation Timeout" (see https://everything.curl.dev/usingcurl/returns). I have seen similar errors today when docker images on gitlab tried to connect to the internet, for instance when doing an apt-get install. It wasn't really reproducable though, it happend on different connections each try.

    Although I couldn't find someone one Twitter who was able to confirm this, I suspect gitlab is having some issues today. Maybe if you try it later it will work.

    I assume you copy & pasted the contents from the tutorial. It worked for me when I was doing that step, so there is no real error in these commands.