lxc重命名容器名

lxc-ls 使用文件夹名作为容器名。所以可以更改文件夹名称来达到改变容器名。
但是改变文件夹名称后,同时需要改变容器文件夹中的config文件所对应的相应文件夹。

引用
# 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
#下面两行必须改变
lxc.rootfs = /var/lib/lxc/python3/rootfs
lxc.mount = /var/lib/lxc/python3/fstab

#可以随意
lxc.utsname = ipython3
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


然后进入rootfs/etc文件夹,改变hostname文件host名称

猜你喜欢

转载自j4s0nh4ck.iteye.com/blog/2244746