# Docker Compose Rootfs Upgrade

**URL:** <https://hub.mender.io/t/docker-compose-rootfs-upgrade/7415>\
**Category:** General Discussions\
**Tags:** docker, update-modules, system-update\
**Created:** [December 20, 2024, 2:48pm UTC](https://hub.mender.io/t/docker-compose-rootfs-upgrade/7415 "2024-12-20T14:48:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![stabl-gjn](https://avatars.discourse-cdn.com/v4/letter/s/edb3f5/32.png) [@stabl-gjn](https://hub.mender.io/u/stabl-gjn)\
**Post date:** [December 20, 2024, 2:48pm UTC](https://hub.mender.io/t/docker-compose-rootfs-upgrade/7415/1 "2024-12-20T14:48:25Z")

</div>

Hey there,

we are planning to deploy our custom application with the docker-compose update module. Along side normal app deployments we are also planning for rootfs upgrades.  
We are running a custom Yocto Image based on the Kirkstone branch.

Docker stores the images in `/var/lib/docker` by default which is on the root partition. This means if we do any rootfs upgrade the images, states, … are also all replaced/rolled back.

Is there any suggestion/best practices to handle this? E.g. would it be recommended to move the docker root directory to `/data/...`.

If anybody has any experience with this, i would be very happy over any input.

Thanks

---

<div class="post-metadata">

**Author:** ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)\
**Post date:** [December 20, 2024, 4:03pm UTC](https://hub.mender.io/t/docker-compose-rootfs-upgrade/7415/2 "2024-12-20T16:03:11Z")

</div>

Hi @stabl-gjn,

Generally I would suggest to put the containers on a separate data partition, not onto `/data`. In a Yocto based setup, you can do this through the `MENDER_EXTRA_PARTS` variable, as documented here: [Variables | Mender documentation](https://docs.mender.io/operating-system-updates-yocto-project/variables#mender_extra_parts).

This solves a couple of issues:

- persisting across root filesystem updates
- avoiding out of storage errors on the root filesystem due to containers

What I don’t know off the bat is if docker needs to additionally persist pieces of its configuration, such as things in `/etc`. If so, that also needs to by symlinked to a data partition. My personal take on it would be to put it into the same one which also holds the containers.

Greetz,  
Josef

---

<div class="post-metadata">

**Author:** ![stabl-gjn](https://avatars.discourse-cdn.com/v4/letter/s/edb3f5/32.png) [@stabl-gjn](https://hub.mender.io/u/stabl-gjn)\
**Post date:** [December 20, 2024, 4:14pm UTC](https://hub.mender.io/t/docker-compose-rootfs-upgrade/7415/3 "2024-12-20T16:14:52Z")

</div>

Hi @TheYoctoJester,

thanks so much for the very quick answer.

One question though, why an extra partition and not the data partition itself?

---

<div class="post-metadata">

**Author:** ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)\
**Post date:** [December 20, 2024, 4:20pm UTC](https://hub.mender.io/t/docker-compose-rootfs-upgrade/7415/4 "2024-12-20T16:20:52Z")

</div>

Hi @stabl-gjn,

It’s just a precaution to keep the system operable if for whatever reason the containers eat up all storage that they can get. If it’s limited to their own partition, the main system will be operable, and you will be able to fix it. If you can’t write anything to a configuration file, then your options are quite limited, so that’s what you should avoid.

Greetz,  
Josef
