Fleet & Docker - How to maintain state?

I am running Fleet 8.3.3 in a Docker Container, using the docs found here:

It appears that every time the container is destroyed and a new one created, a new Fleet server is registered, even if I set the container hostname to the same string (test02 in this case):

How do I set this up so that a new Fleet instance is not created every time the container is rebuilt?

I believe if you don't want things to change on every startup, you need to persist the data directory (/opt/Elastic/Agent/) - Installation layout | Fleet and Elastic Agent Guide [8.3] | Elastic. Note, you can also set an auto unenroll timeout, so if you don't want to persist the directory, you can just have the old ones unenroll themselves after a period of time.

1 Like

Thanks @BenB196 - I tried to bind /opt/Elastic/Agent to the host filesystem, but that didnt appear to change anything. Digger deeper into the container I saw /usr/share/elastic-agent/state - Once I bound that to the host filesystem, I was able to maintain state outside of the container.

This does not appear to be documented anywhere.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.