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,220 points

1 answer to this question.

+1 vote
Best answer


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,320 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
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,370 points
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,090 points
+4 votes
4 answers

How To Access a Service on Host From a Docker Container?

Adding to kalgi's answer, You can also ...READ MORE

answered Oct 16, 2018 in Docker by lina
• 8,220 points

edited Oct 16, 2018 by lina 24,566 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,140 points
+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,320 points
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,320 points