How to use yum in Dockerfile correctly
Example of how to install the mkpasswd package using yum in your Dockerfile:
Dockerfile_install_mkpasswd
RUN yum -y install mkpasswd && yum -y clean all && rm -rf /var/cacheThere are two basic aspects to remember here:
- Use
yum -yin order to avoid interactiveY/Nquestions during the automated build - Use
yum -y clean all && rm -rf /var/cacheto clean up after the call toyum -y install
Complete Dockerfile example:
Dockerfile_example
FROM fedora:34
RUN yum -y install mkpasswd && yum -y clean all && rm -rf /var/cacheIf this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow