Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
| ... | ... |
@@ -236,25 +236,22 @@ func validMountMode(mode string) bool {
|
| 236 | 236 |
} |
| 237 | 237 |
|
| 238 | 238 |
func (container *Container) setupMounts() error {
|
| 239 |
- if err := label.SetFileLabel(container.ResolvConfPath, container.MountLabel); err != nil {
|
|
| 240 |
- return err |
|
| 241 |
- } |
|
| 242 | 239 |
mounts := []execdriver.Mount{
|
| 243 | 240 |
{Source: container.ResolvConfPath, Destination: "/etc/resolv.conf", Writable: true, Private: true},
|
| 244 | 241 |
} |
| 245 | 242 |
|
| 246 | 243 |
if container.HostnamePath != "" {
|
| 247 |
- if err := label.SetFileLabel(container.HostnamePath, container.MountLabel); err != nil {
|
|
| 248 |
- return err |
|
| 249 |
- } |
|
| 250 | 244 |
mounts = append(mounts, execdriver.Mount{Source: container.HostnamePath, Destination: "/etc/hostname", Writable: true, Private: true})
|
| 251 | 245 |
} |
| 252 | 246 |
|
| 253 | 247 |
if container.HostsPath != "" {
|
| 254 |
- if err := label.SetFileLabel(container.HostsPath, container.MountLabel); err != nil {
|
|
| 248 |
+ mounts = append(mounts, execdriver.Mount{Source: container.HostsPath, Destination: "/etc/hosts", Writable: true, Private: true})
|
|
| 249 |
+ } |
|
| 250 |
+ |
|
| 251 |
+ for _, m := range mounts {
|
|
| 252 |
+ if err := label.SetFileLabel(m.Source, container.MountLabel); err != nil {
|
|
| 255 | 253 |
return err |
| 256 | 254 |
} |
| 257 |
- mounts = append(mounts, execdriver.Mount{Source: container.HostsPath, Destination: "/etc/hosts", Writable: true, Private: true})
|
|
| 258 | 255 |
} |
| 259 | 256 |
|
| 260 | 257 |
// Mount user specified volumes |