You are correct. Your Dockerfile must add MongoDB’s public key to its listed of trusted sources. Here is a Java example by @wan:
The critical lines are:
RUN wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
RUN echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.com/apt/ubuntu focal/mongodb-enterprise/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-enterprise.list
RUN apt-get update && apt-get install -y mongodb-enterprise mongodb-enterprise-cryptd
Hopefully this helps get you up and running.
Sincerely,
James