# Containerized Fleet Server not maintaining persistence

**URL:** <https://discuss.elastic.co/t/containerized-fleet-server-not-maintaining-persistence/379586>\
**Category:** Elastic Agent\
**Created:** [June 28, 2025, 12:10pm UTC](https://discuss.elastic.co/t/containerized-fleet-server-not-maintaining-persistence/379586 "2025-06-28T12:10:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Preissner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michael_preissner/32/140538_2.png) [@Michael\_Preissner](https://discuss.elastic.co/u/Michael_Preissner)\
**Post date:** [June 28, 2025, 12:10pm UTC](https://discuss.elastic.co/t/containerized-fleet-server-not-maintaining-persistence/379586/1 "2025-06-28T12:10:29Z")

</div>

I'm running elastic-agent-complete:9.0.2 with podman, mounting a /data directory to /usr/share/elastic-agent/data within the container. However, every time the container is restarted, it registers a new fleet server agent. As closely as I can determine, this is a permissions issue in the container. From what I've read, you have to run the container as root (--user 0 in the podman run command); if you run as user 1000, then agent status reports agent: healthy but fleet: failed. But the first thing that happens on container start is that it chowns the paths to root:root, then drops privileges to user 1000, making the entire elastic-agent directory un-writable by elastic agent. This prevents the agent from writing its own state so that it can maintain persistence across container restarts/updates. I'm at my wits end trying to figure this out.

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [June 28, 2025, 1:04pm UTC](https://discuss.elastic.co/t/containerized-fleet-server-not-maintaining-persistence/379586/2 "2025-06-28T13:04:07Z")

</div>

Are you using a compose file? How it looks like?

I have fleet working in container without any issue, I have something like this in my compose:

```auto
      volumes:
        - fleet:/usr/share/elastic-agent/state
      ports:
        - ${FLEET_PORT}:8220
      user: root

```

You need to persiste the state, path not the one you shared.

---

<div class="post-metadata">

**Author:** ![Michael\_Preissner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michael_preissner/32/140538_2.png) [@Michael\_Preissner](https://discuss.elastic.co/u/Michael_Preissner)\
**Post date:** [June 28, 2025, 2:47pm UTC](https://discuss.elastic.co/t/containerized-fleet-server-not-maintaining-persistence/379586/3 "2025-06-28T14:47:54Z")

</div>

No compose. Just using podman run for now until I get it sorted, then will make a systemd config for it. I was originally only mounting the state path, but it never populated with any data, so agent state never persisted across restarts.
