lxc-ls 使用文件夹名作为容器名。所以可以更改文件夹名称来达到改变容器名。
但是改变文件夹名称后,同时需要改变容器文件夹中的config文件所对应的相应文件夹。
[quote]# Template used to create this container: /usr/share/lxc/templates/lxc-ubuntu
# Parameters passed to the template:
# For additional config options, please look at lxc.container.conf(5)
# Common configuration
lxc.include = /usr/share/lxc/config/ubuntu.common.conf
# Container specific configuration
#下面两行必须改变
[color=blue]lxc.rootfs = /var/lib/lxc/python3/rootfs
lxc.mount = /var/lib/lxc/python3/fstab[/color]
#可以随意
[color=blue]lxc.utsname = ipython3[/color]
lxc.arch = amd64
# Network configuration
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = lxcbr0
lxc.network.hwaddr = 00:16:3e:0a:b4:3d[/quote]
然后进入rootfs/etc文件夹,改变hostname文件host名称
但是改变文件夹名称后,同时需要改变容器文件夹中的config文件所对应的相应文件夹。
[quote]# Template used to create this container: /usr/share/lxc/templates/lxc-ubuntu
# Parameters passed to the template:
# For additional config options, please look at lxc.container.conf(5)
# Common configuration
lxc.include = /usr/share/lxc/config/ubuntu.common.conf
# Container specific configuration
#下面两行必须改变
[color=blue]lxc.rootfs = /var/lib/lxc/python3/rootfs
lxc.mount = /var/lib/lxc/python3/fstab[/color]
#可以随意
[color=blue]lxc.utsname = ipython3[/color]
lxc.arch = amd64
# Network configuration
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = lxcbr0
lxc.network.hwaddr = 00:16:3e:0a:b4:3d[/quote]
然后进入rootfs/etc文件夹,改变hostname文件host名称