Reputation: 12205
How do I add a couple of packages to the default Ubuntu installation in lxc, so that the results are cached?
Currently my script creates containers like this
lxc-create -t ubuntu -n foo -- --packages "firefox,python2.7,python-pip"
It works but is very slow, as it downloads installation packages with massive dependencies every single time I create a container. Is there a way to include these in the default Ubuntu installation, so that they would be downloaded once and then cached, speeding up creation of consecutive containers?
Upvotes: 3
Views: 2918
Reputation: 46
I would recommend looking at the apt-cacher-ng package: https://launchpad.net/ubuntu/+source/apt-cacher-ng.
I found a guide on how to install it here: http://www.distrogeeks.com/install-apt-cacher-ng-ubuntu/.
Apt on your host machine "should" cache packages downloaded on your host machine, but there is no harm in configuring apt on your host machine to use the apt-cacher-ng cache as well.
But configuring the container "machines" to use apt-cacher-ng on the host machine can reduce the time spent on downloading the same packages on different containers quite a lot.
Upvotes: 2