Skip to content

exec apk del create cache file,can we use apk del --no-cache,Reduced image size 1M #708

@khs1994

Description

@khs1994

I found image have apk cache file

$ docker run -it --rm php:7.2.9-fpm-alpine ls -la /var/cache/apk

total 1260
drwxr-xr-x    1 root     root          4096 Aug 23 00:18 .
drwxr-xr-x    1 root     root          4096 Jul  5 14:47 ..
-rw-r--r--    1 root     root        750769 Aug 23 00:18 APKINDEX.adfa7ceb.tar.gz
-rw-r--r--    1 root     root        525412 Aug 23 00:18 APKINDEX.efaa1f73.tar.gz

Then I found this cache file create by $ apk del

$ docker run -it --rm alpine:3.8 sh

$ apk add --no-cache php

$ ls -la /var/cache/apk

# empty

$ apk del php

$ ls -la /var/cache/apk

drwxr-xr-x    1 root     root          4096 Aug 23 09:07 .
drwxr-xr-x    1 root     root          4096 Jul  5 14:47 ..
-rw-r--r--    1 root     root        750769 Aug 23 09:07 APKINDEX.adfa7ceb.tar.gz
-rw-r--r--    1 root     root        525412 Aug 23 09:07 APKINDEX.efaa1f73.tar.gz

exec apk del create cache file on /var/cache/apk

exec apk del --no-cache don't create cache file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    RequestRequest for image modification or feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions