Problems with Image caching

Posted October 16, 2020 1.1k views
DockerDigitalOcean App Platform

It seems that app platform has some problems with image caching (?) when building from Dockerfile.

My last deployment was building with two separate stages

FROM node:14-alpine AS builder
# ...
FROM my-app
# ...

The problem is that as soon as I removed the first stage since I don’t need it anymore, the build stopped working and DO seems to be trying to fetch an image called builder from docker hub.

I confirmed this is the problem because now I’m stuck with a Dockerfile that needs an empty FROM node:14-alpine AS builder just to make it work.

Please add an option to clear the cache, otherwise it seems it’s not possible to even change the image I was using as base.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

@WoLfulus 👋

I tried reproducing this with our sample-dockerfile repo.

git clone
cd sample-dockerfile
doctl app create --spec .do/app.yaml

This creates an app from a multi-stage Dockerfile similar to what you’re describing:

FROM golang:1.12-alpine as builder
COPY . .
RUN go build -mod=vendor -o bin/hello

FROM alpine
RUN apk --no-cache add ca-certificates
WORKDIR /root/
COPY --from=builder /app/bin/hello /usr/local/bin/
CMD ["hello"]

Then, updating that to a single stage Dockerfile and redeploying:

git checkout one-stage


FROM golang:1.12-alpine
COPY . .
RUN go build -mod=vendor -o bin/hello && \
    cp bin/hello /usr/local/bin/hello
RUN apk --no-cache add ca-certificates
CMD ["hello"]

doctl app update $APP_ID --spec .do/app.yaml

My build + deploy succeeded. Are you able to share more of your dockerfiles or simplified versions that can be used to reproduce?

Show answer This answer has been marked as resolved by otak.