feat: add the possibility to add registry mirrors

This commit is contained in:
Bert-Jan Fikse 2025-12-19 15:10:07 +01:00
parent 6ab3505dc8
commit db50c3d989
Signed by: bert-jan
GPG key ID: C1E0AB516AC16D1A
3 changed files with 21 additions and 0 deletions

View file

@ -7,3 +7,8 @@ docker_compose_base_dir: /etc/docker/compose
# Global docker volume directory configuration # Global docker volume directory configuration
docker_volume_base_dir: /srv/data docker_volume_base_dir: /srv/data
# Docker registry mirror configuration
# Set to empty list to disable registry mirror
# Example: docker_registry_mirrors: ["https://mirror.example.com"]
docker_registry_mirrors: []

View file

@ -1,3 +1,9 @@
#SPDX-License-Identifier: MIT-0 #SPDX-License-Identifier: MIT-0
--- ---
# handlers file for base # handlers file for base
- name: restart docker
ansible.builtin.systemd:
name: docker
state: restarted
when: ansible_virtualization_type != "docker"

View file

@ -63,6 +63,16 @@
update_cache: true update_cache: true
when: ansible_os_family == "Debian" when: ansible_os_family == "Debian"
- name: Configure Docker daemon with registry mirror
ansible.builtin.template:
src: daemon.json.j2
dest: /etc/docker/daemon.json
owner: root
group: root
mode: '0644'
notify: restart docker
when: ansible_os_family == "Debian"
- name: Start and enable Docker service - name: Start and enable Docker service
ansible.builtin.systemd: ansible.builtin.systemd:
name: docker name: docker