[Lxc-users] File sharing between host and container during startup
Nirmal Guhan
vavatutu at gmail.com
Mon Jun 7 18:39:06 UTC 2010
>
> AFAICS, you would like to share the filesystem, maybe you not need to
> specify a rootfs.
>
> I suggest you remove the containers you previously created in order to
> restart on a sane base. In case, list them with "lxc-ls" to make sure you
> have no remaining containers set on your system.
>
> Then just do without any previous creation:
>
> lxc-execute -n foo <myapplication>
>
> Your application will run with its own private mount points, pids, ipcs,
> uts and setup with a cgroup.
>
> If you need more isolation like the network:
>
> create a configuration file "eg. lxc.conf"
>
> lxc.utsname = myapplication
> lxc.network.type = veth
> lxc.network.flags = up
> lxc.network.link = br0
> lxc.network.ipv4 = 1.2.3.5/24
>
> and launch it with the command lxc-execute -n foo -f lxc.conf
> <myapplication>
>
> Or alternatively without a configuration file,
>
> lxc-execute -n foo -s lxc.utsname=myapplication -s lxc.network.type=veth -s
> lxc.network.flags=up -s lxc.network.link=br0 -s lxc.network.ipv4=
> 1.2.3.5/24 <myapplication>
>
> At this point, if you need to be more secure or the application you are
> launching is writing to a directory and this is conflicting with another
> instance of the same application, let me know, I will give you a more
> complex configuration.
>
> What is needed are informations about the application (a web server, a
> sshd, an autistic application, etc ...).
>
> Thanks
> -- Daniel
>
>
Hi Daniel,
It seems to work after I removed the rootfs and fstab from the config file.
Otherwise I get an error as below :
> [root at guhan-fedora lxc]# lxc-ls
> [root at guhan-fedora lxc]# lxc-execute -n centos -f centos.config /bin/bash
> lxc-execute: No such file or directory - failed to exec
> /usr/libexec/lxc-init
> [root at guhan-fedora lxc]# lxc-create -n centos -f centos.config
> 'centos' created
> [root at guhan-fedora lxc]# lxc-execute -n centos /bin/bash
> lxc-execute: No such file or directory - failed to exec
> /usr/libexec/lxc-init
> [root at guhan-fedora lxc]# lxc-execute -n centos -f centos.config /bin/bash
> lxc-execute: No such file or directory - failed to exec
> /usr/libexec/lxc-init
> [root at guhan-fedora lxc]#
>
Removing rootfs fixes the issue and my app runs. Does this mean, application
container does NOT need rootfs and hence installation of the distro etc. ?
For system containers, I installed rootfs using debootstrap. I believe these
steps are not required. Please enlighten.
Thanks,
Nirmal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20100607/9a827618/attachment.html>
More information about the lxc-users
mailing list