Closed ghost closed 6 years ago
The reason for the logs is the Anaconda post copy logs script
[root@localhost tmp]# cat /usr/share/anaconda/post-scripts/99-copy-logs.ks
# Note, this script log will not be copied to the installed system.
%post --nochroot
NOSAVE_INPUT_KS_FILE=/tmp/NOSAVE_INPUT_KS
NOSAVE_LOGS_FILE=/tmp/NOSAVE_LOGS
PRE_ANA_LOGS=/tmp/pre-anaconda-logs
if [ -e ${NOSAVE_LOGS_FILE} ]; then
rm -f ${NOSAVE_LOGS_FILE}
else
mkdir -p $ANA_INSTALL_PATH/var/log/anaconda
for log in anaconda.log syslog X.log program.log packaging.log storage.log ifcfg.log yum.log; do
[ -e /tmp/$log ] && cp /tmp/$log $ANA_INSTALL_PATH/var/log/anaconda/
done
[ -e /tmp/pre-anaconda-logs ] && cp -r $PRE_ANA_LOGS $ANA_INSTALL_PATH/var/log/anaconda
cp /tmp/ks-script*.log $ANA_INSTALL_PATH/var/log/anaconda/
journalctl -b > $ANA_INSTALL_PATH/var/log/anaconda/journal.log
chmod 0600 $ANA_INSTALL_PATH/var/log/anaconda/*
# Copy over any rhsm logs
[ -e /var/log/rhsm/ ] && cp -r /var/log/rhsm $ANA_INSTALL_PATH/var/log/
fi
if [ -e ${NOSAVE_INPUT_KS_FILE} ]; then
rm -f ${NOSAVE_INPUT_KS_FILE}
else
[ -e /run/install/ks.cfg ] && cp /run/install/ks.cfg $ANA_INSTALL_PATH/root/original-ks.cfg
fi
%end
Might a touch /tmp/NOSAVE_LOGS
in a %pre
configuration script prevent the logs in the Docker image? Should that be done? Or should the logs be shipped with the image?
The kickstart files for the CentOS 7 Docker images contain post commands which should remove "thing we don't need", e.g. the Anaconda log files and temporary kickstart scripts
but these files are still part of the CentOS 7 images
How to remove these files via the post configuration?