How to use yum in Dockerfile correctly
Example of how to install the mkpasswd
package using yum
in your Dockerfile
:
RUN yum -y install mkpasswd && yum -y clean all && rm -rf /var/cache
There are two basic aspects to remember here:
- Use
yum -y
in order to avoid interactiveY/N
questions during the automated build - Use
yum -y clean all && rm -rf /var/cache
to clean up after the call toyum -y install
Complete Dockerfile
example:
FROM fedora:34
RUN yum -y install mkpasswd && yum -y clean all && rm -rf /var/cache