Ensure Local cache path not used in apk add
The --no-cache
option allows to not cache the index locally, which is useful for keeping containers small.
Risk Level: informational
Platform: Docker
Spectral Rule ID: DOCKR002
REMEDIATION
Append any apk add
command with --no-cache
flag.
FROM alpine:3.3
- RUN apk add python
+ RUN apk add --no-cache python
WORKDIR /app
ONBUILD COPY . /app
ONBUILD RUN virtualenv /env && /env/bin/pip install -r /app/requirements.txt
EXPOSE 8080
CMD ["/env/bin/python", "main.py"]
Read more:
Updated over 1 year ago