Пример #1
0
func parseDevices(devices []string) ([]runconfig.DeviceMapping, error) {
	// parse device mappings
	deviceMappings := []runconfig.DeviceMapping{}
	for _, device := range devices {
		deviceMapping, err := runconfig.ParseDevice(device)
		if err != nil {
			return nil, err
		}
		deviceMappings = append(deviceMappings, deviceMapping)
	}

	return deviceMappings, nil
}
Пример #2
0
func parseDevices(devices []string) ([]dockerclient.Device, error) {
	// parse device mappings
	deviceMappings := []dockerclient.Device{}
	for _, device := range devices {
		v, err := runconfig.ParseDevice(device)
		if err != nil {
			return nil, err
		}
		deviceMappings = append(deviceMappings, dockerclient.Device{
			PathOnHost:        v.PathOnHost,
			PathInContainer:   v.PathInContainer,
			CgroupPermissions: v.CgroupPermissions,
		})
	}

	return deviceMappings, nil
}