[lxc-users] multi unprivileged containers running tomcat7
Serge Hallyn
serge.hallyn at ubuntu.com
Mon May 19 20:37:51 UTC 2014
Quoting Morten Steffensen (msteff at emercos.com):
> This is how i created the containers:
Aha, thanks.
> host: ubuntu 14.04 minimal
>
> root>apt-get install lxc
> root>groupadd lxc-adm (groupid 1000)
> root>adduser --gid 1000 --home /home/lxcuser lxcuser
> root>echo "lxcuser veth lxcbr0 2" | tee -a /etc/lxc/lxc-usernet
That lets you connect two veths to lxcbr0,
> lxcuser>mkdir -p ~/.config/lxc
> lxcuser>echo "lxc.id_map = u 0 100000 65536" > ~/.config/lxc/default.conf
> lxcuser>echo "lxc.id_map = g 0 100000 65536" >> ~/.config/lxc/default.conf
> lxcuser>echo "lxc.network.type = veth" >> ~/.config/lxc/default.conf
> lxcuser>echo "lxc.network.link = lxcbr0" >> ~/.config/lxc/default.conf
>
>
>
>
> /etc/lxc/dnsmasq.conf
> dhcp-host=tomcat1,10.0.3.101
> dhcp-host=tomcatmysql2,10.0.3.102
> dhcp-host=tomcatmysql3,10.0.3.103
>
> /etc/default/lxc-net
> USE_LXC_BRIDGE="true"
> LXC_BRIDGE="lxcbr0"
> LXC_ADDR="10.0.3.1"
> LXC_NETMASK="255.255.255.0"
> LXC_NETWORK="10.0.3.0/24"
> LXC_DHCP_RANGE="10.0.3.2,10.0.3.254"
> LXC_DHCP_MAX="253"
> LXC_DHCP_CONFILE=/etc/lxc/dnsmasq.conf
>
> lxcuser>lxc-create -t download -n tomcat1 -- -d ubuntu -r trusty -a i386
> lxcuser>lxc-start -n tomcat1 -d
>
> lxcuser>ssh ubuntu at 10.0.3.101
> ubuntu at 10.0.3.101>sudo apt-get update
> ubuntu at 10.0.3.101>sudo apt-get upgrade
> ubuntu at 10.0.3.101>sudo apt-get install default-jdk
> ubuntu at 10.0.3.101>sudo apt-get install tomcat7
> lxcuser>lxc-stop -n tomcat1
>
> lxcuser>lxc-clone -o tomcat1 -n tomcatmysql2
> lxcuser>lxc-start -n tomcatmysql2 -d
> lxcuser>ssh ubuntu at 10.0.3.102
> ubuntu at 10.0.3.102>sudo apt-get install mysql-server-5.6
> lxcuser>lxc-stop -n tomcatmysql2
>
> lxcuser>lxc-clone -o tomcatmysql2 -n tomcatmysql3
> lxcuser>lxc-start -n tomcatmysql3 -d
that's one veth,
> lxcuser>lxc-start -n tomcatmysql2 -d
that's two,
> lxcuser>lxc-start -n tomcat1 -d
that would be a third :)
> lxc_container: command get_cgroup failed to receive response
>
>
> Apparently it works sometimes.. i thought it was the problem with 2
> tomcat instances, then i thought it was 2 mysql, but it seems to be
> related to something else. It is not a consequently error.
>
> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users
More information about the lxc-users
mailing list