How to install packages in a Docker container

+1 vote

Hi Guys,

I am new in Docker. I want to install some of packages in a docker container. How can I do that?

Thank You

Apr 15, 2020 in Docker by akhtar
• 38,240 points
87,468 views

1 answer to this question.

+1 vote
Best answer

Hi@akhtar,

To install packages in a docker container, the packages should be defined in the Dockerfile.

If you want to install packages in the Container, use the RUN statement followed by exact download command .

$ RUN pip install <package name > //IN Windows
$ RUN apt-get install <package name > //in Ubuntu
$ RUN yum install <package name> //CentOS/RHEL

You can update the Dockerfile with latest list of packages at anytime and build again to create new image out of it.

Hope this will help.

answered Apr 15, 2020 by MD
• 95,380 points

selected Nov 25, 2020 by akhtar

Related Questions In Docker

+3 votes
4 answers

How to install packages inside a docker Ubuntu image?

Execute the update and the install command ...READ MORE

answered Apr 24, 2019 in Docker by Vismaya
35,917 views
0 votes
1 answer

How to create a container and run images in docker?

Look for what all images you have ...READ MORE

answered Feb 23, 2019 in Docker by Kalgi
• 52,350 points
1,089 views
0 votes
1 answer

How to Backup, Restore or Migrate data volumes in a docker container?

Steps to Backup a container 1)     ...READ MORE

answered Jul 3, 2019 in Docker by Sirajul
• 59,190 points
12,912 views
0 votes
0 answers

How to install PHP composer inside a docker container

I'm trying to figure out how to ...READ MORE

Apr 12 in Docker by Abhijeet
• 180 points
4,156 views
+2 votes
1 answer
+2 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 58,100 points
1,844 views
+1 vote
1 answer

How to mount a host directory in a Docker container?

Hi@akhtar, You can use the -v option in ...READ MORE

answered Dec 23, 2020 in Docker by MD
• 95,380 points
1,306 views
0 votes
1 answer

How can I install systemctl tool in Docker container?

Hi@akhtar, In docker container if you want to ...READ MORE

answered Feb 5, 2020 in Docker by MD
• 95,380 points
14,363 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP