Skip to content

Commit f697165

Browse files
committed
fix: force apt cache update in Docker installation for GitHub Actions containers
- Remove cache_valid_time constraint to ensure fresh package list - Add force_apt_get flag to bypass apt caching issues - Add debugging information to troubleshoot repository availability - Fixes 'No package matching docker.io is available' error in CI
1 parent 873d577 commit f697165

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

templates/ansible/install-docker.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,29 @@
1717
ansible.builtin.debug:
1818
msg: "🚀 Installing Docker CE via Ubuntu repositories on {{ inventory_hostname }}"
1919

20-
- name: Update apt cache
20+
- name: Force update apt cache for container environment
2121
ansible.builtin.apt:
2222
update_cache: true
23-
cache_valid_time: 3600
23+
force_apt_get: true
2424
when: ansible_os_family == "Debian"
2525

26+
- name: Ensure universe repository is available
27+
ansible.builtin.shell: |
28+
apt-cache policy docker.io || echo "docker.io not found"
29+
apt list --installed | grep -E "(universe|multiverse)" | head -5 || echo "No universe/multiverse packages found"
30+
register: repo_check
31+
changed_when: false
32+
33+
- name: Display repository check results
34+
ansible.builtin.debug:
35+
var: repo_check.stdout_lines
36+
2637
- name: Install Docker from Ubuntu repositories
2738
ansible.builtin.apt:
2839
name:
2940
- docker.io
3041
state: present
42+
force_apt_get: true
3143
when: ansible_os_family == "Debian"
3244
register: docker_install
3345

0 commit comments

Comments
 (0)