瀏覽代碼

Only mount hostname files if config exists

Michael Crosby 11 年之前
父節點
當前提交
5a01f7485c
共有 1 個文件被更改,包括 2 次插入0 次删除
  1. 2 0
      lxc_template.go

+ 2 - 0
lxc_template.go

@@ -30,9 +30,11 @@ lxc.network.ipv4 = {{.NetworkSettings.IPAddress}}/{{.NetworkSettings.IPPrefixLen
 {{$ROOTFS := .RootfsPath}}
 {{$ROOTFS := .RootfsPath}}
 lxc.rootfs = {{$ROOTFS}}
 lxc.rootfs = {{$ROOTFS}}
 
 
+{{if and .HostnamePath .HostsPath}}
 # enable domain name support
 # enable domain name support
 lxc.mount.entry = {{.HostnamePath}} {{$ROOTFS}}/etc/hostname none bind,ro 0 0
 lxc.mount.entry = {{.HostnamePath}} {{$ROOTFS}}/etc/hostname none bind,ro 0 0
 lxc.mount.entry = {{.HostsPath}} {{$ROOTFS}}/etc/hosts none bind,ro 0 0
 lxc.mount.entry = {{.HostsPath}} {{$ROOTFS}}/etc/hosts none bind,ro 0 0
+{{end}}
 
 
 # use a dedicated pts for the container (and limit the number of pseudo terminal
 # use a dedicated pts for the container (and limit the number of pseudo terminal
 # available)
 # available)