Remove stuck portainer_agent container before redeploying
If the container exists but is in a Restarting state (e.g. due to a stale AGENT_HOST env var), remove it so the deploy task creates a fresh container with the correct config. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
9fa819a10d
commit
fd71d5b82c
@ -107,6 +107,12 @@
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
|
||||
- name: Remove portainer_agent container if stuck in restart loop
|
||||
community.docker.docker_container:
|
||||
name: portainer_agent
|
||||
state: absent
|
||||
when: "'Restarting' in (agent_status.stdout | default(''))"
|
||||
|
||||
- name: Pull Portainer Agent image
|
||||
community.docker.docker_image:
|
||||
name: portainer/agent
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user