From 93866644c68dd8ade2a69a548b98775e6ff16452 Mon Sep 17 00:00:00 2001 From: cmeng Date: Wed, 24 May 2023 09:21:21 +1200 Subject: [PATCH] fix(GPU): EE-4331 error when enabling gpu on existing container (#8316) --- .../views/containers/create/createContainerController.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/docker/views/containers/create/createContainerController.js b/app/docker/views/containers/create/createContainerController.js index 625bbf0ca..9a10f258a 100644 --- a/app/docker/views/containers/create/createContainerController.js +++ b/app/docker/views/containers/create/createContainerController.js @@ -502,7 +502,11 @@ angular.module('portainer.docker').controller('CreateContainerController', [ } deviceRequest.Capabilities = [gpuOptions.capabilities]; - config.HostConfig.DeviceRequests.push(deviceRequest); + if (config.HostConfig.DeviceRequests) { + config.HostConfig.DeviceRequests.push(deviceRequest); + } else { + config.HostConfig.DeviceRequests = [deviceRequest]; + } } function prepareConfiguration() {