How to install OpenCV on AWS Deep Learning Base AMI (Ubuntu 18.04) Version 27.0

I have a Docker container running on an AWS EC2 instance which uses the following:

OpenCV v4.5.1
Cuda 11.0.3
Cudnn 8

I have the Dockerfile and can follow the instructions for building from source.
I have another AWS EC2 instance which has come pre-built with the following:

Nvidia driver version: 450.51.05
CUDA versions available: cuda-10.0 cuda-10.1 cuda-10.2
Default CUDA version is 10.0
Libraries: cuDNN, NCCL, Intel MKL-DNN

I tried to install OpenCV v4.5.1 on the second AWS EC2 instance but received the following error:

– Configuring incomplete, errors occurred!

There were quite a few packages not found in the log output.
I’m guessing this is because OpenCV 4.5.1 is not compatible with Cuda 10.0.

How can I fix this issue? Is it simply a case of changing the version of OpenCV I’m installing and if so how can I find out which one I need to use?