# How to copy files from replicaset to localhost?

**URL:** <https://forums.percona.com/t/how-to-copy-files-from-replicaset-to-localhost/14711>\
**Category:** Percona Operator for MongoDB\
**Created:** [March 11, 2022, 10:27am UTC](https://forums.percona.com/t/how-to-copy-files-from-replicaset-to-localhost/14711 "2022-03-11T10:27:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamoser](https://avatars.discourse-cdn.com/v4/letter/j/b2d939/32.png) [@jamoser](https://forums.percona.com/u/jamoser)\
**Post date:** [March 11, 2022, 10:27am UTC](https://forums.percona.com/t/how-to-copy-files-from-replicaset-to-localhost/14711/1 "2022-03-11T10:27:14Z")

</div>

In order to use “kubectl cp” the source container needs “tar”. Seems tar is not available and to install tar is also not possible (?).

Any solutions how to do that ?

---

<div class="post-metadata">

**Author:** ![Ege\_Gunes](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/ege_gunes/32/4595_2.png) [@Ege\_Gunes](https://forums.percona.com/u/Ege_Gunes)\
**Post date:** [March 11, 2022, 11:02am UTC](https://forums.percona.com/t/how-to-copy-files-from-replicaset-to-localhost/14711/2 "2022-03-11T11:02:56Z")

</div>

Hi @jamoser,

Which version of mongo you’re using? PSMDB 4.0 and 5.0 images have this problem (tar does not exist) but 4.2 and 4.4 should be fine.

---

<div class="post-metadata">

**Author:** ![jamoser](https://avatars.discourse-cdn.com/v4/letter/j/b2d939/32.png) [@jamoser](https://forums.percona.com/u/jamoser)\
**Post date:** [March 11, 2022, 2:10pm UTC](https://forums.percona.com/t/how-to-copy-files-from-replicaset-to-localhost/14711/3 "2022-03-11T14:10:06Z")

</div>

I am using MongoDB Operator with MongoDB 4.4 - and there is no tar. And also it’s not possible to install it on the fly.

---

<div class="post-metadata">

**Author:** ![Ege\_Gunes](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/ege_gunes/32/4595_2.png) [@Ege\_Gunes](https://forums.percona.com/u/Ege_Gunes)\
**Post date:** [March 16, 2022, 6:24am UTC](https://forums.percona.com/t/how-to-copy-files-from-replicaset-to-localhost/14711/4 "2022-03-16T06:24:15Z")

</div>

Could you share the exact image you’re using? I’ll share with the build team

---

<div class="post-metadata">

**Author:** ![jamoser](https://avatars.discourse-cdn.com/v4/letter/j/b2d939/32.png) [@jamoser](https://forums.percona.com/u/jamoser)\
**Post date:** [March 16, 2022, 7:15am UTC](https://forums.percona.com/t/how-to-copy-files-from-replicaset-to-localhost/14711/5 "2022-03-16T07:15:55Z")

</div>

crVersion: 1.11.0  
image: percona/percona-server-mongodb:4.4.10-11

Thanks  
John
