Docker --lxc-conf参数设置

  lxc-conf配置项:

       lxc-conf配置项的格式为       --lxc-conf="key = value "  可以有多项

       Cgroup部分(所有Cgroup子系统的配置参数均可以通过lxc-cgroup 命令进行动态获得或者调整)主要用于配置CPU和内存资源

   对应的key值主要有,cpu ,cpuset 如

   

  lxc.cgroup.cpuset.cpus = 0,1

  lxc.cgroup.cpu.shares = 1234

  lxc.cgroup.devices.deny= a

  lxc.cgroup.devices.allow= c 1:3 rw

  lxc.cgroup.devices.allow= b 8:0 rw

  关于内存的有

 

  lxc.cgroup.memory.limit_in_bytes= 512M     #最小使用内存

  lxc.cgroup.memory.memsw.limit_in_bytes= 1G   #mem+swa最小1G

  lxc.cgroup.memory.memsw.max_usage_in_bytes= 1G   #mem+swap最大可达1G

   lxc.cgroup.memory.max_usage_in_byte = 1G   #最大内存使用量1G

 

  关于网络的:

  lxc.network.type = veth      #docker下是这种类型
  lxc.network.flags = up
  lxc.network.link = br0        #指定虚拟网卡对应的网桥
  lxc.network.hwaddr = 4a:49:43:49:79:bf
  lxc.network.ipv4 = 10.2.3.5/24 10.2.3.255

  lxc.network.name = eth0    #指定网卡名称

  lxc.network.ipv4.gateway = 10.2.3.1

  lxc.network.ipv6 = 2003:db8:1:0:214:1234:fe0b:3597
  lxc.network.ipv6 = 2003:db8:1:0:214:5432:feab:3588
  lxc.network.type = macvlan
  lxc.network.flags = up
  lxc.network.link = eth0
  lxc.network.hwaddr = 4a:49:43:49:79:bd
  lxc.network.ipv4 = 10.2.3.4/24
  lxc.network.ipv4 = 192.168.10.125/24
  lxc.network.ipv6 = 2003:db8:1:0:214:1234:fe0b:3596
  lxc.network.type = phys
  lxc.network.flags = up
  lxc.network.link = dummy0
  lxc.network.hwaddr = 4a:49:43:49:79:ff
  lxc.network.ipv4 = 10.2.3.6/24
  lxc.network.ipv6 = 2003:db8:1:0:214:1234:fe0b:3297

  其他:

  lxc.arch指定处理器架构如  :

   x86, i686, x86_64, amd64

 

  还可以指定挂载点如:lxc.mount  lxc.mount.entry

  指定跟文件系统类型:lxc.rootfs  lxc.rootfs.mount

 

  一个设置固定IP的例子:

docker run --lxc-conf="lxc.network.type=veth" --lxc-conf="lxc.network.ipv4=10.85.110.20/24" --lxc-conf="lxc.network.ipv4.gateway=10.85.110.5" --lxc-conf="lxc.network.link=docker0" --lxc-conf="lxc.network.name=eth0"  --lxc-conf="lxc.network.flags=up" -it --net=none sinoahoo163/ubuntu_base /bin/bash

你可能感兴趣的:(Docker)