fix: Wait for Docker socket and login to registry before compose up

- Change Docker daemon wait from TCP port 2375 to Unix socket /var/run/docker.sock
- Add Docker registry login task before docker compose up
- Ensures authentication is available when pulling images
- Fixes 'no basic auth credentials' error during image pull
This commit is contained in:
2025-11-08 16:53:22 +01:00
parent 294e6721eb
commit 891c73d0af

View File

@@ -225,13 +225,23 @@
- name: Wait for Docker daemon to be ready
wait_for:
port: 2375
host: localhost
path: /var/run/docker.sock
timeout: 10
when: docker_daemon_updated.changed | default(false)
ignore_errors: yes
become: no
- name: Login to Docker registry before compose up
community.docker.docker_login:
registry_url: "{{ docker_registry }}"
username: "{{ docker_registry_username | default('admin') }}"
password: "{{ registry_password }}"
when:
- registry_password | string | trim != ''
- registry_accessible == 'true'
no_log: yes
ignore_errors: yes
- name: Deploy application stack with new image
shell: |
cd {{ application_code_dest }}