LXC介绍及开发

u55270 57 0 PDF 2020-07-29 10:07:36

LXC介绍,配置,demo,api简介及开发IxC-ubuntuPublished on夢想家(hp/ datahunter,org使用 ubuntu-cloud template<-EC2/ doud imag相同sudo Ixc-create-tubuntu-Cloud-nmy-cloud-container設定:設定檔/etc/default/xc●/etc/xc/ c. onfupsets●etc^ nit/xc. conf<-當 LXC AUTO="ue,它負責自動啟動/etc/xc/auto內的VOS/ etc/initlxc-net conf< USE LXC BRIDGE="ue"負責使用 NATed bridge for containers tousestorageWar/lib/xcWar/cache/xc更改:sudo mkdir /srv/lxclib /srv/lxccache sudo rm -rf /var/lib/lxc /var/cache/lxc sudo In -s /srv/lxclib /var/lib/lxc sudo In -s /srv/lxccache/var/cache/lxcletc/defauitxcPage 3 of 11ubuntuPublished on夢想家(hp/ datahunter,orgLXC AUTO=trueUSE LXC BRIDGE=truelxc ?? network ? (PrivateNetworkLXC BE工DGE=11 chro2222 true ?2 1xcbr0????LⅩ C ADDR=11C.C.3,1mLⅩ C NETMASK="255.255.255,0"LXC NETWORK-10.0.3.0/24LXC DHCP RANGE="10.0.3.2,10.0.3.254LⅩ C DHCP MAⅩ=253LⅩ C ShuTdoWn T工 MEOUT=120Server ??? ,??? kill ?? vps (service lxc restart)Aet/xcxcconf所有ps的 default Network設定值(只適用於 C-createlxc network type=vethIxc network. link-lxcbr0 <--??/etc/default/lxc ? IXC BRIDGEIxc. network. flags=upHost Network ConfigureBrdge Networkauto etho1 face⊙ tho inet manuaaddress o..0. oauto broiface bro inet dhcpbridge ports ethobridge stp offbridge waitport OPage4 of 11ubuntuPublished on夢想家(hp/ datahunter,orgbridge fd oVPS Network ConfigureLc networktyrlxc network type=empty●empy●veth(deau≮-對應 XC network linkpr-對應 IC network linkvan--IxC network vlan. ide macleanXC network. macvlan mode( Default private),另有vepabriddFullExample一股:⊥xC. network.fags=upIxc network.ink =Ixcbrolxc network. ipv4 =10.2.3.4/24ps ?? ip1xC. network.ipv4=192.168.10.125/24Ixc. network. name ethos???29etho eth1 eth2進階:?? NetworkIxc network type veth?⊥xC. network,ype???lxC network. flags upIxc networklink bro1xC.netw○≌k. hado=4a:49:43:49:79:bf1xc. network.ipv4=10.2.3.5/2410.2.3.255Ixc network. veth pair=<--??????,?????veth?????Page 5of 11ubuntuPublishedon券想家(http://datahunter.org井??? Networklxc network typelxc network. flags upIxc network link dummy oIxc. network. hwaddr = 4a:49: 43:49:79: fIIxc network. ipv4 =10.2.3.6/24scarchlxc. arch86i686●X8664●amd64資源:CPUXc cgroup cpuset cpus=03<-設定v可以用CPU的ce0及3 default只有core0可用/sys/fs/cgroup/cpuset/lxc/vps>/cpuset cpusXc cgroup cpushares=1024<-Deut比例來/sys/fs/cgroup/ cpu/lxc/vps>/cpu sharesPage 6of 11IxC-ubuntuPublished on夢想家(hp/ datahunter,org即時修改echo 1,2,3>/sys/fs/cgroup/cpuset/lxc//cpusetcpusecho 0-7 >/sys/fscgroup/cpuset/lxc//cpuset cpusRAMIxC cgroup. memory limit_in_ bytes =256Mxc croup. memory. mems limit in bytes=lGDeviceIxc cgroup devices deny=aIxc cgroup devices allow=c1:3rwlxc cgroup devices allow=b 8: 0rw查看所有 devicerIXC-cgoup-n debian devices listc 1:3 rwmc 1.5 rwmc 5:1 rwmc 5:0 rwmc 4:0 rwmc 4:1 rwmc 1:9 rwmc 1:8 rwmc 136: rwmc 5: 2 rwm254:0wmDEVPTSIxC. pts-16IxC tty=8IxC console <--path to a file where the consdleoutput will bewritten cnone will simply disable the console)Page7 of 11ubuntuPublished on夢想家(hp/ datahunter,orgmount與root5IXC.mount=proc proc proc node, noexec, nosuid00lxc. mount entry = sysfs sys sysfs defaults, ro00lxC rootfs =/dev/xc/debianLVMLxccgroup.[subsystemnamelLxc. drop<--spaceseparationExamplelxc cap. drop= sys_ admin <---defaultIxc cap. drop=mac_override啟動:Startlxc-start-n myminlxc-fmymconfAuto startsudo In -s /var/lib/lxC/CN/config /etc/lxc/auto/CN. confPage of 11IxC-ubuntuPublishedon券想家(http://datahunter.orgConsoleIXC-console-n debianIxC-console-n debian-t2Type

LXC介绍及开发

用户评论
请输入评论内容
评分:
Generic placeholder image 卡了网匿名网友 2020-07-29 10:07:39

对于初次使用lxc还是有帮助

Generic placeholder image 卡了网匿名网友 2020-07-29 10:07:37

使用lxc的手册,内容还是差一点,对入门有用