Oracle Linux containers
By Wcoekaer-Oracle on Dec 04, 2013
Dwight's one of the major contributors to lxc. One of the things he did a while back, was adding support in lxc-create to understand how to create Oracle Linux images. All you have to do is provide a version number and it will figure out which yum repos to connect to on http://public-yum.oracle.com and download the required rpms and install them in a local subdirectory. This is of course superconvenient and incredibly fast. So... I played with that briefly this morning and here's the very short summary.
Start out with a standard Oracle Linux 6.5 install and uek3. Make sure to add/install lxc if it's not yet there (yum install lxc) and you're good to go.
*note - you also have to create /container for lxc - so also do mkdir /container after you install lxc, thank Tony for pointing this out.
# lxc-create -n ol65 -t oracle -- -R 6.5.
That's it. lxc-create will know this is an Oracle Linux container, using OL6.5's repository to create the container named ol65.
lxc-create automatically connects to public-yum, figures out which repos to use for 6.5, downloads all required rpms and generates the container. At the end you will see :
Configuring container for Oracle Linux 6.5 Added container user:oracle password:oracle Added container user:root password:root Container : /container/ol65/rootfs Config : /container/ol65/config Network : eth0 (veth) on virbr0 'oracle' template installed 'ol65' created
Now all you need to do is :
lxc-start --name ol65
And you are up and running with a new container. Very fast, very easy.
If you want an OL5.9 container (or so) just do lxc-create -n ol59 -t oracle -- -R 5.9. Done. lxc has tons of very cool features, which I will get into more later. You can use this model to import images into docker as well, instead of using febootstrap.
# lxc-create -n ol65 -t oracle -- -R 6.5 # tar --numeric-owner -jcp -C /container/ol65/rootfs . | \ docker import - ol6.5 # lxc-destroy -n ol65