mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Put the resolv.conf path in a variable instead of being hardcoded within lxc
This commit is contained in:
parent
e41fd24542
commit
1f9f5eed5d
3 changed files with 13 additions and 8 deletions
|
@ -34,12 +34,13 @@ type Container struct {
|
|||
NetworkSettings *NetworkSettings
|
||||
|
||||
SysInitPath string
|
||||
ResolvConfPath string
|
||||
|
||||
cmd *exec.Cmd
|
||||
stdout *writeBroadcaster
|
||||
stderr *writeBroadcaster
|
||||
stdin io.ReadCloser
|
||||
stdinPipe io.WriteCloser
|
||||
|
||||
ptyMaster io.Closer
|
||||
|
||||
runtime *Runtime
|
||||
|
|
|
@ -78,7 +78,7 @@ lxc.mount.entry = devpts {{$ROOTFS}}/dev/pts devpts newinstance,ptmxmode=0666,no
|
|||
lxc.mount.entry = {{.SysInitPath}} {{$ROOTFS}}/sbin/init none bind,ro 0 0
|
||||
|
||||
# In order to get a working DNS environment, mount bind (ro) the host's /etc/resolv.conf into the container
|
||||
lxc.mount.entry = /etc/resolv.conf {{$ROOTFS}}/etc/resolv.conf none bind,ro 0 0
|
||||
lxc.mount.entry = {{.ResolvConfPath}} {{$ROOTFS}}/etc/resolv.conf none bind,ro 0 0
|
||||
|
||||
|
||||
# drop linux capabilities (apply mainly to the user root in the container)
|
||||
|
|
|
@ -82,6 +82,9 @@ func (runtime *Runtime) Create(config *Config) (*Container, error) {
|
|||
if config.Hostname == "" {
|
||||
config.Hostname = id[:12]
|
||||
}
|
||||
|
||||
resolvConfPath := "/etc/resolv.conf"
|
||||
|
||||
container := &Container{
|
||||
// FIXME: we should generate the ID here instead of receiving it as an argument
|
||||
Id: id,
|
||||
|
@ -93,6 +96,7 @@ func (runtime *Runtime) Create(config *Config) (*Container, error) {
|
|||
NetworkSettings: &NetworkSettings{},
|
||||
// FIXME: do we need to store this in the container?
|
||||
SysInitPath: sysInitPath,
|
||||
ResolvConfPath: resolvConfPath,
|
||||
}
|
||||
container.root = runtime.containerRoot(container.Id)
|
||||
// Step 1: create the container directory.
|
||||
|
|
Loading…
Reference in a new issue