LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Containers
User Name
Password
Linux - Containers This forum is for the discussion of all topics relating to Linux containers. Docker, LXC, LXD, runC, containerd, CoreOS, Kubernetes, Mesos, rkt, and all other Linux container platforms are welcome.

Notices


Reply
  Search this Thread
Old 11-22-2016, 09:23 AM   #1
czezz
Member
 
Registered: Nov 2004
Distribution: Slackware/Solaris
Posts: 931

Rep: Reputation: 44
docker - cant install additional software/packages inside container


I try to install new package inside of docker image/container.
I follow some examples that I have google'd and it does not really work like for them:

Code:
[root@centos7 ~]# docker run -it ubuntu bash
root@2869c7f4bb2e:/# apt-get install htop
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package htop
root@2869c7f4bb2e:/#
What am I doing wrong?
 
Old 11-22-2016, 11:02 AM   #2
sag47
Senior Member
 
Registered: Sep 2009
Location: Raleigh, NC
Distribution: Ubuntu, PopOS, Raspbian
Posts: 1,899
Blog Entries: 36

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
Code:
apt-get update
apt-get install htop
To update the package cache. Package cache is usually cleared to make the container image size smaller.

If that doesn't work, then test network connectivity. If you don't have connectivity, then restart the docker daemon as it is likely missing iptables rules for routing.

Last edited by sag47; 11-24-2016 at 10:10 AM.
 
1 members found this post helpful.
Old 11-25-2016, 12:25 AM   #3
sag47
Senior Member
 
Registered: Sep 2009
Location: Raleigh, NC
Distribution: Ubuntu, PopOS, Raspbian
Posts: 1,899
Blog Entries: 36

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
I forgot to mention if you're building on another image to customize it then don't forget to clean up the package cache to keep the image size reasonable.
 
Old 11-28-2016, 10:48 AM   #4
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Don't forget to rebuild the new container once you manage to get htop installed,
After rebuilding, htop stays installed.

Here's some docker.fu
http://www.dockerbook.com/TheDockerBook_sample.pdf
https://blog.docker.com/2013/06/14-g...als-on-docker/
http://stackoverflow.com/search?q=docker
https://blog.docker.com/2015/03/dock...ommand-basics/
 
Old 08-17-2017, 03:04 PM   #5
UCotter
LQ Newbie
 
Registered: Mar 2012
Posts: 4

Rep: Reputation: Disabled
Dockerfile?

What are you using for your base image? Can you post the contents of your Dockerfile?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Inside the Open Container Project: How Docker plans to unite the container market LXer Syndicated Linux News 0 06-23-2015 04:30 AM
rhel 5 install additional packages from cd sandhyarani Linux - Newbie 1 04-08-2009 04:42 AM
Failed to install any additional packages in fedora-9 vicky7038 Linux - Software 7 09-03-2008 06:51 AM
How to Install Additional Packages JonBL Fedora 8 10-31-2006 11:28 PM
Can't install additional packages from CD darkmatter333 Fedora 1 06-29-2005 08:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Containers

All times are GMT -5. The time now is 12:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration