Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot install packages inside docker Ubuntu image

I installed Ubuntu 14.04 image on docker. After that, when I try to install packages inside the ubuntu image, I'm getting unable to locate package error:

apt-get install curl  Reading package lists... Done Building dependency tree        Reading state information... Done E: Unable to locate package curl 

How to fix this error?

like image 667
Developer Avatar asked Dec 03 '14 13:12

Developer


People also ask

Can I install packages in docker container?

Method 1: Using Command Line InterfaceTo install any packages, you first need to update the OS. Step 3: After you have updated the Docker Container, you can now install the Firefox and Vim packages inside it. You can now easily use these packages through the bash itself.


1 Answers

It is because there is no package cache in the image, you need to run:

apt-get update 

before installing packages, and if your command is in a Dockerfile, you'll then need:

apt-get -y install curl 

To suppress the standard output from a command use -qq. E.g.

apt-get -qq -y install curl 
like image 53
ISanych Avatar answered Oct 21 '22 23:10

ISanych