Question

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

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 …ls command is working properly but when i tries to install a package it is not working…can anyone help me??


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello,

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.

Regards, Bobby