# How to deploy a canister locally to an existing (already running) replica from a separate directory/repo

**URL:** <https://forum.dfinity.org/t/how-to-deploy-a-canister-locally-to-an-existing-already-running-replica-from-a-separate-directory-repo/18002>\
**Category:** Developers\
**Created:** [January 16, 2023, 5:25pm UTC](https://forum.dfinity.org/t/how-to-deploy-a-canister-locally-to-an-existing-already-running-replica-from-a-separate-directory-repo/18002 "2023-01-16T17:25:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![blabagastered](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/blabagastered/32/8592_2.png) [@blabagastered](https://forum.dfinity.org/u/blabagastered)\
**Post date:** [January 16, 2023, 5:25pm UTC](https://forum.dfinity.org/t/how-to-deploy-a-canister-locally-to-an-existing-already-running-replica-from-a-separate-directory-repo/18002/1 "2023-01-16T17:25:35Z")

</div>

I just deployed and ICRC locally but since I did it from its own directory (following these instructions [icrc1/readme.md at main · NatLabs/icrc1 · GitHub](https://github.com/NatLabs/icrc1/blob/main/readme.md#getting-started)), I had to do create a new replica with

`dfx start --background --clean`

Whereas I want it to be deployed in an already-running replica (running from another directory).

How do I instruct the deployment of the ICRC token such that it’s deployed to the existing replica without co-mingling both the token and the other project’s repos?

Would that be the right approach? The aim is to call and interact with the ICRC canister from my other canister deployed in the other replica.

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [January 17, 2023, 7:23am UTC](https://forum.dfinity.org/t/how-to-deploy-a-canister-locally-to-an-existing-already-running-replica-from-a-separate-directory-repo/18002/2 "2023-01-17T07:23:12Z")

</div>

I do not see anything in these instructions that would require `--clean`. If you just skip that flag, you should be good to go. `--clean` wipes all state from previous runs, so please still use it occasionally if you run into weird problems or if you want to install the nns canisters.

---

<div class="post-metadata">

**Author:** ![blabagastered](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/blabagastered/32/8592_2.png) [@blabagastered](https://forum.dfinity.org/u/blabagastered)\
**Post date:** [January 17, 2023, 11:48pm UTC](https://forum.dfinity.org/t/how-to-deploy-a-canister-locally-to-an-existing-already-running-replica-from-a-separate-directory-repo/18002/3 "2023-01-17T23:48:28Z")

</div>

dfx didn’t seem to “see” the other replica running from another project directory, so `--clean` didn’t seem to be the cause. In the end I just added the new canister to the original project directory to run them together.
