Removing what was added in previous layer in docker
use this technique
RUN curl http://someaddress/test.rpm &&\
yum -y --nogpgcheck localinstall /rpms/test.rpm &&\
rm test.rpm
you cannot remove data from previous layers. If the /rpms/
folder is huge and you absolutely don't want its data in your docker image you have at least two solutions:
- do not
ADD
the data (since it will commit a layer), instead use a singleRUN
instruction to:- download the rpm file
- install the rpm file
- delete the rpm file
- flatten your image afterwards