Found this extensive opencl docker topic how to do opencl with amdgpu. However there are 'some' side notes considering AMD GPU support, the problem is a mix of diversity and deprecating driver support among different product lines over time. If you consider to include AMDGPU support for your container approach please continue reading. It will be a lot of IF/ELSE conditions but could be very usefull.
First we have the opensource kernel driver amdgpu which ships as the default driver in most of the linuxdistro's. This driver can be extended with MESA opensource OpenGL support, also ships in most linux distro's. Both are maintained and work great on new 5xxx 6xxx navi/big-navi to polaris RX-4xx/5xx and even the legacy GPU's GCN1-3 (HD7xxx-R9-3XX). The Mesa OpenGL performance outruns the closed source OpenGL drivers from AMD themself by huge margins and keeps improving for not only newer but also to the dated GPU's. In most distro's kernel there is also kfd besides amdgpu. This component is used to extend the free opensource kernel driver with compute capabilites closed&open source. However for some PRO graphic apps like Davinci Resolve it is required to use the closed AMDGPU Proprietary OpenGl version besides OpenCL!
This closed OpenGL driver is a first requirement since D.R. 16.1 to work with their AMD proprietary OpenCL stack (interop). Between DR 16.1 - 17, this interop proprietary OpenGL + OpenCL requirement could be worked-around, but since DR 17 it is really required! Good news is that the closed AMDGPU OpenGl driver can co-exist on the same system as with the already installed kernel AMDGPU driver and Mesa OpenGL driver and can be manually loaded/linked with SHELL Variables for specific programs.
Now the OpenCL stack on linux for AMDGPU comes offcourse again in many (forced) flavours, but it gets shipped/delivered with the same AMDGPU proprietary driver from the AMD website that also gives proprietary OpenGL.
*AMD Closed OpenCL ORCA/Legacy GCN1-4 less dated 2021 (usefull for D.R)
*AMD Closed OpenCL PAL Vega very dated 2020 (usefull for D.R)
*AMD ROCM opensource OpenCL (dated releases in the past worked for older GPUs, and newer releases might again for newer GPU's nothing in between...)
*AMD ROCR partly replaces PAL (usefull for D.R)
*Mesa Clover opensource OpenCl dated (not usefull for D.R)
*Mesa RustiCl opensource OpenCl new (not yet tested)
Around spring 2021s AMD deprecated pre-polaris GCN1-3 HD7xxx R9-3XX GPU's from the AMDGPU proprietary driver (all platforms Windows/Linux), and OpenCL support broke earlier... The good news is that newer cards (big)navi rdna1/2 still profit from a similar proprietary OpenGL rand OpenCL replacement / linking trick.
To summarize, this docker+amd Davinci Resolve support to be usefull is atleast 2 directions past/future. Detect distro/kernel version compatible with AMDGPU pro driver or add workaround for forcing the driver installing/extracting libs on other distro/kernel versions than officially supported. Than for AMDGPU's before Polaris like GCN1-3, HD7xxx R9-3XX, filter by device-id/name and download the dated older 21.20 21.30/40/50 although listed on AMD their own website broken for orca OpenCl AMDGPU proprietary driver, extract and only static link proprietary OpenGL with use of static linked Orca/legacy OpenCl for them. Not sure if they still work with newest 'amdgpu/kfd' kernel driver which comes with newer distro's still have to test. Than for newer polaris/vega/rdna1/2(big)navi download the latest and do the same identification but again with multiple directions, using OpenCl PAL or even RocM perhaps for Vega (removed since 20.40/45)?) than RoCR for anything after that like RDNA1/2?
This is offcourse a extreme simplification, but has worked in the past on seperate gpu's using different distro's. First thing to try is if I can get DR 17.x working in supported ubuntu 20.04 with 21.1030 OpenGL/OpenCL within Docker. Than try a newer D.R. 18x or maybe a newer Ubuntu and see if that works?
Nevermind the choices in AMD Vulkan landscape on linux ;-) ...
EDIT: Took the AMD proprietary driver versions suggested by Thomas Debesse.
Found this extensive opencl docker topic how to do opencl with amdgpu. However there are 'some' side notes considering AMD GPU support, the problem is a mix of diversity and deprecating driver support among different product lines over time. If you consider to include AMDGPU support for your container approach please continue reading. It will be a lot of IF/ELSE conditions but could be very usefull.
First we have the opensource kernel driver
amdgpuwhich ships as the default driver in most of the linuxdistro's. This driver can be extended with MESA opensource OpenGL support, also ships in most linux distro's. Both are maintained and work great on new 5xxx 6xxx navi/big-navi to polaris RX-4xx/5xx and even the legacy GPU's GCN1-3 (HD7xxx-R9-3XX). The Mesa OpenGL performance outruns the closed source OpenGL drivers from AMD themself by huge margins and keeps improving for not only newer but also to the dated GPU's. In most distro's kernel there is alsokfdbesidesamdgpu. This component is used to extend the free opensource kernel driver with compute capabilites closed&open source. However for some PRO graphic apps like Davinci Resolve it is required to use the closed AMDGPU Proprietary OpenGl version besides OpenCL!This closed OpenGL driver is a first requirement since D.R. 16.1 to work with their AMD proprietary OpenCL stack (interop). Between DR 16.1 - 17, this interop proprietary OpenGL + OpenCL requirement could be worked-around, but since DR 17 it is really required! Good news is that the closed AMDGPU OpenGl driver can co-exist on the same system as with the already installed kernel AMDGPU driver and Mesa OpenGL driver and can be manually loaded/linked with SHELL Variables for specific programs.
Now the OpenCL stack on linux for AMDGPU comes offcourse again in many (forced) flavours, but it gets shipped/delivered with the same AMDGPU proprietary driver from the AMD website that also gives proprietary OpenGL.
*AMD Closed OpenCL ORCA/Legacy GCN1-4 less dated 2021 (usefull for D.R)
*AMD Closed OpenCL PAL Vega very dated 2020 (usefull for D.R)
*AMD ROCM opensource OpenCL (dated releases in the past worked for older GPUs, and newer releases might again for newer GPU's nothing in between...)
*AMD ROCR partly replaces PAL (usefull for D.R)
*Mesa Clover opensource OpenCl dated (not usefull for D.R)
*Mesa RustiCl opensource OpenCl new (not yet tested)
Around spring 2021s AMD deprecated pre-polaris GCN1-3 HD7xxx R9-3XX GPU's from the AMDGPU proprietary driver (all platforms Windows/Linux), and OpenCL support broke earlier... The good news is that newer cards (big)navi rdna1/2 still profit from a similar proprietary OpenGL rand OpenCL replacement / linking trick.
To summarize, this docker+amd Davinci Resolve support to be usefull is atleast 2 directions past/future. Detect distro/kernel version compatible with AMDGPU pro driver or add workaround for forcing the driver installing/extracting libs on other distro/kernel versions than officially supported. Than for AMDGPU's before Polaris like GCN1-3, HD7xxx R9-3XX, filter by device-id/name and download the dated older 21.20
21.30/40/50 although listed on AMD their own website broken for orca OpenClAMDGPU proprietary driver, extract and only static link proprietary OpenGL with use of static linked Orca/legacy OpenCl for them. Not sure if they still work with newest 'amdgpu/kfd' kernel driver which comes with newer distro's still have to test. Than for newer polaris/vega/rdna1/2(big)navi download the latest and do the same identification but again with multiple directions, using OpenCl PAL or even RocM perhaps for Vega (removed since 20.40/45)?) than RoCR for anything after that like RDNA1/2?This is offcourse a extreme simplification, but has worked in the past on seperate gpu's using different distro's. First thing to try is if I can get DR 17.x working in supported ubuntu 20.04 with 21.10
30OpenGL/OpenCL within Docker. Than try a newer D.R. 18x or maybe a newer Ubuntu and see if that works?Nevermind the choices in AMD Vulkan landscape on linux ;-) ...
EDIT: Took the AMD proprietary driver versions suggested by Thomas Debesse.