Alpine multistage build not finding apk

I am trying to pass a previous build into a new layer of an alpine image. If I do the below I get:

COPY --from=stage2 / /

RUN apk add --no-cache bash

/bin/sh: 1: apk: not found

If I do the below, bash will get installed but previous build packages are not in the image layer.

COPY --from=stage2 / .

RUN apk add --no-cache bash

How can I copy the previous build so apk is found with the packages added? Thank you :).

1 Like