mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
daemon.WithDevices(): use containerd's HostDevices()
Trying to reduce the use of libcontainer/devices, as it's considered to be an "internal" package by runc. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
93d560d5b3
commit
9d9b8e0cf3
1 changed files with 2 additions and 5 deletions
|
@ -27,7 +27,6 @@ import (
|
||||||
"github.com/moby/sys/mount"
|
"github.com/moby/sys/mount"
|
||||||
"github.com/moby/sys/mountinfo"
|
"github.com/moby/sys/mountinfo"
|
||||||
"github.com/opencontainers/runc/libcontainer/cgroups"
|
"github.com/opencontainers/runc/libcontainer/cgroups"
|
||||||
"github.com/opencontainers/runc/libcontainer/devices"
|
|
||||||
"github.com/opencontainers/runc/libcontainer/user"
|
"github.com/opencontainers/runc/libcontainer/user"
|
||||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
@ -874,13 +873,11 @@ func WithDevices(daemon *Daemon, c *container.Container) coci.SpecOpts {
|
||||||
devPermissions := s.Linux.Resources.Devices
|
devPermissions := s.Linux.Resources.Devices
|
||||||
|
|
||||||
if c.HostConfig.Privileged && !userns.RunningInUserNS() {
|
if c.HostConfig.Privileged && !userns.RunningInUserNS() {
|
||||||
hostDevices, err := devices.HostDevices()
|
hostDevices, err := coci.HostDevices()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
for _, d := range hostDevices {
|
devs = append(devs, hostDevices...)
|
||||||
devs = append(devs, oci.Device(d))
|
|
||||||
}
|
|
||||||
|
|
||||||
// adding device mappings in privileged containers
|
// adding device mappings in privileged containers
|
||||||
for _, deviceMapping := range c.HostConfig.Devices {
|
for _, deviceMapping := range c.HostConfig.Devices {
|
||||||
|
|
Loading…
Reference in a new issue