mirror of https://github.com/docker/docs.git
Handle data volumes mount points
This commit is contained in:
parent
35d704c8a0
commit
8d9aaee60b
17
container.go
17
container.go
|
@ -400,9 +400,26 @@ func (container *Container) Start() error {
|
|||
container.Config.MemorySwap = -1
|
||||
}
|
||||
|
||||
// Create the requested volumes volumes
|
||||
for volPath := range container.Config.Volumes {
|
||||
if c, err := container.runtime.volumes.Create(nil, container, ""); err != nil {
|
||||
return err
|
||||
} else {
|
||||
if err := os.MkdirAll(path.Join(container.RootfsPath(), volPath), 0755); err != nil {
|
||||
return nil
|
||||
}
|
||||
root, err := c.root()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
container.Config.Volumes[volPath] = root
|
||||
}
|
||||
}
|
||||
|
||||
if err := container.generateLXCConfig(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
params := []string{
|
||||
"-n", container.Id,
|
||||
"-f", container.lxcConfigPath(),
|
||||
|
|
|
@ -79,7 +79,11 @@ 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 = {{.ResolvConfPath}} {{$ROOTFS}}/etc/resolv.conf none bind,ro 0 0
|
||||
|
||||
{{if .Config.Volumes}}
|
||||
{{range $T0, $T1 := .Config.Volumes}}
|
||||
lxc.mount.entry = {{$T1}}/layer {{$ROOTFS}}/{{$T0}} none bind,rw 0 0
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
||||
# drop linux capabilities (apply mainly to the user root in the container)
|
||||
lxc.cap.drop = audit_control audit_write mac_admin mac_override mknod setfcap setpcap sys_admin sys_boot sys_module sys_nice sys_pacct sys_rawio sys_resource sys_time sys_tty_config
|
||||
|
|
Loading…
Reference in New Issue