how to install a package inside a fresh centos image pulled inside a docker??

Posted September 28, 2018 796 views

yum -y install package_name is not working........i just pulled centos image directly from docker hub and run it with following command:
docker -i -t run centos
it entered a new shell prompt command is working properly but when i tries to install a package it is not working.....can anyone help me??

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer


I had a similar issue recently. I noticed that the containers were not able to do any DNS lookups so yum was failing to resolve the repos, to fix that I only had to restart docker:

systemctl restart docker

After the restart, it all started working as normal.