Skip to content

Commit e3ac200

Browse files
committed
Clean up old docker images with ansible playbook
1 parent 354b15f commit e3ac200

File tree

1 file changed

+3
-0
lines changed
  • infrastructure/ansible/playbooks/api/roles/api/tasks

1 file changed

+3
-0
lines changed

infrastructure/ansible/playbooks/api/roles/api/tasks/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@
5252
- name: Rename new api docker container
5353
shell: docker rename "{{ container_name }}" api
5454

55+
- name: Cleanup old docker images
56+
shell: docker image prune -a --filter "until=48h" -f
57+
5558
rescue:
5659
- name: Save unhealthy api docker container logs
5760
shell: docker logs "{{ container_name }}" | sed -e 's/\x1b\[[0-9;]*m//g' > "/home/{{ ansible_user }}/unhealthy-$(date +%s)-{{ container_name }}.log" 2>&1

0 commit comments

Comments
 (0)