diff --git a/ansible/group_vars/all/settings.yml.example b/ansible/group_vars/all/settings.yml.example
index e52ae28422872df1f7eeb30d336b75f435a3c41a..6e6eb534d6caa341b089f60fe466ed31bea44ad7 100644
--- a/ansible/group_vars/all/settings.yml.example
+++ b/ansible/group_vars/all/settings.yml.example
@@ -12,7 +12,8 @@ admin_email: "admin@example.com"
 acme_staging: false
 
 # It is possible to add a docker mirror that serves images from docker.io.
-docker_mirror: {}
+docker_mirror:
+  enabled: false
   # endpoint: URL of docker mirror
   # username: username for auth
   # password: password for auth
diff --git a/ansible/roles/pre-configure/tasks/main.yml b/ansible/roles/pre-configure/tasks/main.yml
index b28b114c4a52719738bda902de452559c7d43eab..53a953ae8a4ba497c1d856d2c8174fc5efec12a6 100644
--- a/ansible/roles/pre-configure/tasks/main.yml
+++ b/ansible/roles/pre-configure/tasks/main.yml
@@ -116,4 +116,4 @@
     src: registries.yaml
     dest: /etc/rancher/k3s/registries.yaml
     mode: '0740'
-  when: docker_mirror is not empty
+  when: docker_mirror.enabled
diff --git a/openappstack/cluster.py b/openappstack/cluster.py
index 1472913b23819c8abf19c76f0026298c089d0515..2db0c6687dbfc463ff47be21ca2b2e47aab948c7 100644
--- a/openappstack/cluster.py
+++ b/openappstack/cluster.py
@@ -177,6 +177,7 @@ class Cluster:
         if self.docker_mirror_endpoint \
                 and self.docker_mirror_username \
                 and self.docker_mirror_password:
+            settings['docker_mirror']['enabled'] = True
             settings['docker_mirror']['endpoint'] = self.docker_mirror_endpoint
             settings['docker_mirror']['username'] = self.docker_mirror_username
             settings['docker_mirror']['password'] = self.docker_mirror_password