diff --git a/templates/gitlab-ci-docker.yml b/templates/gitlab-ci-docker.yml
index bf6d22339c8fe6ccdb3b959d4579cf405226ea5b..892d44e030279d10688c1deb163b6dd1ceee76af 100644
--- a/templates/gitlab-ci-docker.yml
+++ b/templates/gitlab-ci-docker.yml
@@ -996,8 +996,7 @@ docker-trivy:
     mkdir -p ./reports
     if [[ -z "${DOCKER_TRIVY_ADDR}" ]]; then
       log_warn "\\e[93mYou are using Trivy in standalone mode. To get faster scans, consider setting the DOCKER_TRIVY_ADDR variable to the address of a Trivy server. More info here: https://aquasecurity.github.io/trivy/latest/docs/references/modes/client-server/\\e[0m"
-      trivy image --download-db-only ${DOCKER_TRIVY_DB_REPOSITORY:+--db-repository $DOCKER_TRIVY_DB_REPOSITORY} ${DOCKER_TRIVY_JAVA_DB_REPOSITORY:+--java-db-repository $DOCKER_TRIVY_JAVA_DB_REPOSITORY}
-      export trivy_opts="image"
+      export trivy_opts="image ${DOCKER_TRIVY_DB_REPOSITORY:+--db-repository $DOCKER_TRIVY_DB_REPOSITORY}"
     else
       log_info "You are using Trivy in client/server mode with the following server: ${DOCKER_TRIVY_ADDR}"
       export trivy_opts="image --server ${DOCKER_TRIVY_ADDR}"