mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #17677 from fboudra/master
Remove yum cache to reduce image size
This commit is contained in:
commit
3c6962f22d
1 changed files with 8 additions and 7 deletions
|
@ -39,8 +39,6 @@ if [[ -z $name ]]; then
|
||||||
usage
|
usage
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#--------------------
|
|
||||||
|
|
||||||
target=$(mktemp -d --tmpdir $(basename $0).XXXXXX)
|
target=$(mktemp -d --tmpdir $(basename $0).XXXXXX)
|
||||||
|
|
||||||
set -x
|
set -x
|
||||||
|
@ -72,21 +70,23 @@ NETWORKING=yes
|
||||||
HOSTNAME=localhost.localdomain
|
HOSTNAME=localhost.localdomain
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# effectively: febootstrap-minimize --keep-zoneinfo --keep-rpmdb
|
# effectively: febootstrap-minimize --keep-zoneinfo --keep-rpmdb --keep-services "$target".
|
||||||
# --keep-services "$target". Stolen from mkimage-rinse.sh
|
|
||||||
# locales
|
# locales
|
||||||
rm -rf "$target"/usr/{{lib,share}/locale,{lib,lib64}/gconv,bin/localedef,sbin/build-locale-archive}
|
rm -rf "$target"/usr/{{lib,share}/locale,{lib,lib64}/gconv,bin/localedef,sbin/build-locale-archive}
|
||||||
# docs
|
# docs and man pages
|
||||||
rm -rf "$target"/usr/share/{man,doc,info,gnome/help}
|
rm -rf "$target"/usr/share/{man,doc,info,gnome/help}
|
||||||
# cracklib
|
# cracklib
|
||||||
rm -rf "$target"/usr/share/cracklib
|
rm -rf "$target"/usr/share/cracklib
|
||||||
# i18n
|
# i18n
|
||||||
rm -rf "$target"/usr/share/i18n
|
rm -rf "$target"/usr/share/i18n
|
||||||
|
# yum cache
|
||||||
|
rm -rf "$target"/var/cache/yum
|
||||||
|
mkdir -p --mode=0755 "$target"/var/cache/yum
|
||||||
# sln
|
# sln
|
||||||
rm -rf "$target"/sbin/sln
|
rm -rf "$target"/sbin/sln
|
||||||
# ldconfig
|
# ldconfig
|
||||||
rm -rf "$target"/etc/ld.so.cache
|
rm -rf "$target"/etc/ld.so.cache "$target"/var/cache/ldconfig
|
||||||
rm -rf "$target"/var/cache/ldconfig/*
|
mkdir -p --mode=0755 "$target"/var/cache/ldconfig
|
||||||
|
|
||||||
version=
|
version=
|
||||||
for file in "$target"/etc/{redhat,system}-release
|
for file in "$target"/etc/{redhat,system}-release
|
||||||
|
@ -103,6 +103,7 @@ if [ -z "$version" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tar --numeric-owner -c -C "$target" . | docker import - $name:$version
|
tar --numeric-owner -c -C "$target" . | docker import - $name:$version
|
||||||
|
|
||||||
docker run -i -t $name:$version echo success
|
docker run -i -t $name:$version echo success
|
||||||
|
|
||||||
rm -rf "$target"
|
rm -rf "$target"
|
||||||
|
|
Loading…
Reference in a new issue