# Restoring Percona Backup's on Containerized MongoDB via PBM

**URL:** <https://forums.percona.com/t/restoring-percona-backups-on-containerized-mongodb-via-pbm/39472>\
**Category:** Percona Backup for MongoDB\
**Tags:** community, pmm, percona, mongodb\
**Created:** [September 30, 2025, 6:50am UTC](https://forums.percona.com/t/restoring-percona-backups-on-containerized-mongodb-via-pbm/39472 "2025-09-30T06:50:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![vishnu](https://avatars.discourse-cdn.com/v4/letter/v/258eb7/32.png) [@vishnu](https://forums.percona.com/u/vishnu)\
**Post date:** [September 30, 2025, 6:50am UTC](https://forums.percona.com/t/restoring-percona-backups-on-containerized-mongodb-via-pbm/39472/1 "2025-09-30T06:50:55Z")

</div>

I’m currently working on restoring backups in a containerized MongoDB environment. The issue I’m facing is that when I initiate the restore process, it starts, but after running the `describe restore` command, the status shows as either **running** or **down**. The process gets stuck while attempting to stop `mongod`, which causes the container to shut down and the `pbm-agent` to fail. Additionally, PBM does not trigger the container to restart, so the restore never completes. Is there an alternative method to perform restores in a containerized MongoDB setup?

---

<div class="post-metadata">

**Author:** ![radoslaw.szulgo](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/radoslaw.szulgo/32/17315_2.png) [@radoslaw.szulgo](https://forums.percona.com/u/radoslaw.szulgo)\
**Post date:** [September 30, 2025, 9:46am UTC](https://forums.percona.com/t/restoring-percona-backups-on-containerized-mongodb-via-pbm/39472/2 "2025-09-30T09:46:50Z")

</div>

Hi @vishnu ,

I just found this topic that was not answered. Are you still experiencing this issue?

The core of the solution is to prevent the container from exiting when `mongod` it stops.

For physical backups, make sure to use a container that includes both the `mongod` binary as well as the PBM files. Here is an example Dockerfile:

```auto
FROM percona/percona-server-mongodb:latest AS mdb
FROM percona/percona-backup-mongodb:latest AS pbm 

FROM oraclelinux:8 

RUN mkdir -p /data/db /data/configdb 

COPY --from=mdb /usr/bin/mongod /usr/bin/
COPY --from=pbm /usr/bin/pbm* /usr/bin/

```

If you are using a dedicated container for PBM, it should also have read-write access to MongoDB data volume and you should run it under the same user ID as the MongoDB container.

The other solution (might be complementary) is to use an “init system” that runs as PID 1, launches `mongod` as a child process, and reaps any zombie processes. When `mongod` is stopped, the init system remains running, keeping the container alive for the `pbm-agent` to complete its work. Most official Docker images (including newer MongoDB images) now bundle `tini`. You can enable it with a simple flag:

```auto
services:
  mongo:
    image: mongo:6.0
    # Add this line to use tini as the init process
    init: true
...

```

and in the Dockerfile:

```auto
# Install tini
ENV TINI_VERSION v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini

# ... add your pbm-agent setup here ...

# The ENTRYPOINT becomes tini, which then executes your command
ENTRYPOINT ["/tini", "--"]

```

Alternatively, if that’s an option, switch to the Kubernetes platform and use our operator that will make things simpler for you.

---

<div class="post-metadata">

**Author:** ![vishnu](https://avatars.discourse-cdn.com/v4/letter/v/258eb7/32.png) [@vishnu](https://forums.percona.com/u/vishnu)\
**Post date:** [October 8, 2025, 10:37am UTC](https://forums.percona.com/t/restoring-percona-backups-on-containerized-mongodb-via-pbm/39472/3 "2025-10-08T10:37:15Z")

</div>

Hi @radoslaw.szulgo  
I followed the method you suggested, but it didn’t work. While I’m able to perform physical and incremental backups, I’m unable to restore them. Is there any alternative approach to restore other than using `init`?

---

<div class="post-metadata">

**Author:** ![Ivan\_Groenewold](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/ivan_groenewold/32/6299_2.png) [@Ivan\_Groenewold](https://forums.percona.com/u/Ivan_Groenewold)\
**Post date:** [October 8, 2025, 11:11am UTC](https://forums.percona.com/t/restoring-percona-backups-on-containerized-mongodb-via-pbm/39472/4 "2025-10-08T11:11:54Z")

</div>

Hi vishnu, first of all the containers need to run with restart=no. Otherwise the restore won’t be able to complete. It is your responsibility to restart containers after the restore is complete. See [Run in Docker - Percona Backup for MongoDB](https://docs.percona.com/percona-backup-mongodb/install/docker.html) for more details about running in Docker.

During physical restore it is expected that the agent commands will not work as usual, you can uses the configuration file to read the restore status directly from the storage. See [View restore progress - Percona Backup for MongoDB](https://docs.percona.com/percona-backup-mongodb/usage/restore-progress.html#view-restore-progress) for more details.

---

<div class="post-metadata">

**Author:** ![vishnu](https://avatars.discourse-cdn.com/v4/letter/v/258eb7/32.png) [@vishnu](https://forums.percona.com/u/vishnu)\
**Post date:** [October 13, 2025, 6:04am UTC](https://forums.percona.com/t/restoring-percona-backups-on-containerized-mongodb-via-pbm/39472/5 "2025-10-13T06:04:59Z")

</div>

Thanks for the support @Ivan_Groenewold
