[lxc-users] newbee to LXC and LXCFS

Rajasekar Darapuram raj at robinsystems.com
Thu Mar 5 21:14:59 UTC 2015


The container created from scratch seems to work fine, but container whose
rootfs is mounted from a dir is not working....

Here are my logs...Please let me know
My hostmachine name is test05
I created a container by mounting the rootfs (by untaring a image)..This is
not showing the container stats..it showing the host stats

root at test05:~# grep MemTotal /proc/meminfo
MemTotal:       264132048 kB
root at test05:~# lxc-ls -f
NAME                       STATE    IPV4         IPV6  GROUPS  AUTOSTART
------------------------------------------------------------------------
rootfs-from-tar-container  RUNNING  10.7.200.23  -     -       NO

root at test05:~# lxc-cgroup -n rootfs-from-tar-container
memory.limit_in_bytes 1G
root at test05:~# lxc-cgroup -n rootfs-from-tar-container memory.limit_in_bytes
1073741824
root at test05:~# lxc-attach -n rootfs-from-tar-container
root at rootfs-from-tar-container:~# grep MemTotal /proc/meminfo
MemTotal:       264132048 kB
<<<========================= This should be 1GB???
root at rootfs-from-tar-container:~# exit
exit
root at test05:~# dpkg -l | grep lxc
ii  liblxc1
1.1.0+master~20150224-0139-0ubuntu1~trusty amd64        Linux Containers
userspace tools (library)
ii  lxc
1.1.0+master~20150224-0139-0ubuntu1~trusty amd64        Linux Containers
userspace tools
ii  lxc-templates
1.1.0+master~20150224-0139-0ubuntu1~trusty amd64        Linux Containers
userspace tools (templates)
ii  lxcfs                               0.6-0ubuntu1~ubuntu14.04.1~ppa1
       amd64        FUSE based filesystem for LXC
ii  python3-lxc
1.1.0+master~20150224-0139-0ubuntu1~trusty amd64        Linux Containers
userspace tools (Python 3.x bindings)


Now I created a new container by downloading the template and this seems to
show the stats fine...
lxc-create -t ubuntu -n robin-ubuntu-template1
lxc-start -n robin-ubuntu-template1

root at test05:/var/lib/lxc# lxc-ls -f
NAME                       STATE    IPV4         IPV6  GROUPS  AUTOSTART
------------------------------------------------------------------------
rootfs-from-tar-container.robinsystems.com  RUNNING  10.7.200.25  -     -
    NO
robin-ubuntu-template1     RUNNING  10.7.202.5   -     -       NO

root at test05:/var/lib/lxc# lxc-cgroup -n robin-ubuntu-template1
memory.limit_in_bytes
18446744073709551615
root at test05:/var/lib/lxc# grep MemTotal /proc/meminfo
MemTotal:       264132048 kB
root at test05:/var/lib/lxc# lxc-cgroup -n robin-ubuntu-template1
memory.limit_in_bytes 1G
root at test05:/var/lib/lxc#
root at test05:/var/lib/lxc#
root at test05:/var/lib/lxc# lxc-cgroup -n robin-ubuntu-template1
memory.limit_in_bytes
1073741824
root at test05:/var/lib/lxc#
root at test05:/var/lib/lxc#
root at test05:/var/lib/lxc# lxc-attach -n robin-ubuntu-template1
root at robin-ubuntu-template1:/# grep MemTotal /proc/meminfo
MemTotal:        1048576 kB
<<<<==========================This looks good..Shows the memory of 1GB

I see lxcfs being mounted on this container which (while it wasnt on the
firstone)

root at robin-ubuntu-template1:/# mount | grep lxcfs
lxcfs on /proc/cpuinfo type fuse.lxcfs
(rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other)
lxcfs on /proc/meminfo type fuse.lxcfs
(rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other)
lxcfs on /proc/stat type fuse.lxcfs
(rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other)
lxcfs on /proc/uptime type fuse.lxcfs
(rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other)
lxcfs on /sys/fs/cgroup/blkio type fuse.lxcfs
(rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other)
lxcfs on /sys/fs/cgroup/cpu type fuse.lxcfs
(rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other)
lxcfs on /sys/fs/cgroup/cpuacct type fuse.lxcfs
(rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other)
lxcfs on /sys/fs/cgroup/cpuset type fuse.lxcfs
(rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other)
lxcfs on /sys/fs/cgroup/devices type fuse.lxcfs
(rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other)
lxcfs on /sys/fs/cgroup/freezer type fuse.lxcfs
(rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other)
lxcfs on /sys/fs/cgroup/hugetlb type fuse.lxcfs
(rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other)
lxcfs on /sys/fs/cgroup/memory type fuse.lxcfs
(rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other)
lxcfs on /sys/fs/cgroup/systemd type fuse.lxcfs
(rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other)
lxcfs on /sys/fs/cgroup/perf_event type fuse.lxcfs
(rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other)


while the other container I created was by mounting the rootfs (by untaring
a image)? Do you think I need to add any steps as I dont see any of the
lxcfs mount points on my this container

root at test05:/var/lib/lxc# lxc-attach -n
rootfs-from-tar-container.robinsystems.com

root at rootfs-from-tar-container:/# mount | grep lxcfs
<<<====================No LXCFS mounts
root at rootfs-from-tar-container:/# mount
/dev/mapper/localGroup-capsuleVolume on / type ext4 (rw)
none on /proc type proc (rw,noexec,nosuid,nodev)
none on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /dev type tmpfs (rw,mode=0755)
none on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
/dev/disk/by-uuid/b0e9ea78-cc3c-4550-86b2-a790ac7f0897 on /shared type ext4
(rw,relatime,errors=remount-ro,data=ordered)
devpts on /dev/console type devpts
(rw,noexec,nosuid,relatime,mode=600,ptmxmode=000)
none on /sys/fs/cgroup type tmpfs (rw)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
none on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
none on /run/user type tmpfs
(rw,noexec,nosuid,nodev,size=104857600,mode=0755)
cm_processes on /run/cloudera-scm-agent/process type tmpfs (rw,mode=0751)

Please let me know.

Thanks

On Thu, Mar 5, 2015 at 1:56 AM, Fajar A. Nugraha <list at fajar.net> wrote:

> (shrug)
>
> Works for me with ppa:ubuntu-lxc/daily
>
> # grep MemTotal /proc/meminfo
> MemTotal:       12197888 kB
>
> # lxc-cgroup -n c7 memory.limit_in_bytes 1G
>
> # lxc-cgroup -n c7 memory.limit_in_bytes
> 1073741824
>
> # lxc-attach -n c7 -- grep MemTotal /proc/meminfo
> MemTotal:        1048576 kB
>
> --
> Fajar
>
> On Thu, Mar 5, 2015 at 2:38 PM, Rajasekar Darapuram
> <raj at robinsystems.com> wrote:
> > Thanks for the reply..However
> > How come when i create 2 containers (I'm running the command lxc-create
> -f
> > config -n name1 -t none, and my config has the option lxc.rootfs =
> > /containers/container-name )  and run the cpuinfo, meminfo, uptime
> commands
> > on each container, they both are returning the same values and they match
> > the host machine values..
> >
> > Did I miss anything?
> >
> > From: "Fajar A. Nugraha" <list at fajar.net>
> > To: LXC users mailing-list <lxc-users at lists.linuxcontainers.org>
> > Cc:
> > Date: Thu, 5 Mar 2015 06:00:00 +0700
> > Subject: Re: [lxc-users] newbee to LXC and LXCFS
> >
> > On Thu, Mar 5, 2015 at 1:02 AM, Rajasekar Darapuram
> > <raj at robinsystems.com> wrote:
> >> 1. Should I explicitly bind the host /var/lib/lxcfs/cgroup/proc to the
> >> container /proc (or something like /container_proc)
> >
> > Not if you update lxc to 1.1. See
> > https://github.com/lxc/lxcfs/blob/master/README.md
> >
> > --
> > Fajar
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20150305/bdda221e/attachment-0001.html>


More information about the lxc-users mailing list