[lxc-users] How to bring up a container from rootfs tarball

Fajar A. Nugraha list at fajar.net
Mon Aug 18 11:09:15 UTC 2014


>From "man lxc.container.conf"

lxc.rootfs

specify  the  root  file  system for the container. It can be an image
file, a directory or a block device. If not specified, the container shares
its root file system with the host.

Is that what you want?


A quick howto on how to create your own containers manually ("c1" is the
container name in this example):
- create directory /var/lib/lxc/c1
- prepare a suitable rootfs image/directory
- create a config file on /var/lib/lxc/c1/config

For example, the "download" template would create a config file similar to
this

#########################
# Template used to create this container:
/usr/share/lxc/templates/lxc-download
# Parameters passed to the template: -d ubuntu -r trusty -a amd64
# For additional config options, please look at lxc.conf(5)

# Distribution configuration
lxc.include = /usr/share/lxc/config/ubuntu.common.conf
lxc.arch = x86_64

# Container specific configuration
lxc.rootfs = /var/lib/lxc/c1/rootfs
lxc.utsname = c1

# Network configuration
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = lxcbr0
lxc.network.hwaddr = 00:16:3e:c0:bd:f1
#########################

See lxc.rootfs in the config file above?

Again, note that if you use your own rootfs image, you might need to make
some modifications for it to be suitable as lxc root.

-- 
Fajar


On Mon, Aug 18, 2014 at 5:42 PM, Nobin Mathew <nobin.mathew at ericsson.com>
wrote:

> Then I am asking a simpler question. How to say a mount as root
> filesystem, using lxc tools.
>
> -Thanks
> Nobin
>
>
> On 08/14/2014 06:24 PM, Jäkel, Guido wrote:
>
>> Dear Nobin,
>>
>> I found that you may "loop mount" a tarball by using fuse and the
>> libarchive subsystem (http://serverfault.com/
>> questions/138403/mount-a-tar-file-not-possible). Then, you may use this
>> mount as a container root.
>>
>> I found that this even seems to be possible in r/w-mode because (
>> http://archive09.linux.com/feature/132196) [" archivemount delays all
>> write operations until the archive is unmounted."].
>>
>>
>> Greetings
>>
>> Guido
>>
>>
>>  -----Original Message-----
>>> From: lxc-users [mailto:lxc-users-bounces at lists.linuxcontainers.org] On
>>> Behalf Of Nobin Mathew
>>> Sent: Thursday, August 14, 2014 7:13 AM
>>> To: lxc-users at lists.linuxcontainers.org
>>> Subject: [lxc-users] How to bring up a container from rootfs tarball
>>>
>>> Hi All,
>>>
>>> Can you shed some info(or links) on bringing up a container, where I
>>> want to use some root filesystem,(which is basically tarball i.e.
>>> tar.gz).
>>>
>>> I don't want to use the apt/rpms.
>>>
>>> --
>>> -Thanks
>>> Nobin
>>>
>>> _______________________________________________
>>> lxc-users mailing list
>>> lxc-users at lists.linuxcontainers.org
>>> http://lists.linuxcontainers.org/listinfo/lxc-users
>>>
>> _______________________________________________
>> lxc-users mailing list
>> lxc-users at lists.linuxcontainers.org
>> http://lists.linuxcontainers.org/listinfo/lxc-users
>>
>
> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20140818/d293f1e2/attachment.html>


More information about the lxc-users mailing list