# Deploying to new canister on mainnet

**URL:** <https://forum.dfinity.org/t/deploying-to-new-canister-on-mainnet/9701>\
**Category:** Developers\
**Created:** [December 15, 2021, 10:53pm UTC](https://forum.dfinity.org/t/deploying-to-new-canister-on-mainnet/9701 "2021-12-15T22:53:33Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![kevinli](https://avatars.discourse-cdn.com/v4/letter/k/8edcca/32.png) [@kevinli](https://forum.dfinity.org/u/kevinli)\
**Post date:** [December 15, 2021, 10:53pm UTC](https://forum.dfinity.org/t/deploying-to-new-canister-on-mainnet/9701/1 "2021-12-15T22:53:33Z")

</div>

I have currently deployed a canister to mainnet. Is there a way to deploy a second canister with the same code base to mainnet and just choose which one I want to deploy to ad-hoc?

---

<div class="post-metadata">

**Author:** ![anon74414410](https://avatars.discourse-cdn.com/v4/letter/a/85f322/32.png) [@anon74414410](https://forum.dfinity.org/u/anon74414410)\
**Post date:** [December 15, 2021, 10:55pm UTC](https://forum.dfinity.org/t/deploying-to-new-canister-on-mainnet/9701/2 "2021-12-15T22:55:59Z")

</div>

Check out this thread: [Deploy an app twice on the IC (Staging env)](https://forum.dfinity.org/t/deploy-an-app-twice-on-the-ic-staging-env/5661)

---

<div class="post-metadata">

**Author:** ![kevinli](https://avatars.discourse-cdn.com/v4/letter/k/8edcca/32.png) [@kevinli](https://forum.dfinity.org/u/kevinli)\
**Post date:** [December 15, 2021, 11:31pm UTC](https://forum.dfinity.org/t/deploying-to-new-canister-on-mainnet/9701/3 "2021-12-15T23:31:16Z")

</div>

I see, so if I specify --network staging, it will deploy to a different canister than if I specify --network ic?

---

<div class="post-metadata">

**Author:** ![anon74414410](https://avatars.discourse-cdn.com/v4/letter/a/85f322/32.png) [@anon74414410](https://forum.dfinity.org/u/anon74414410)\
**Post date:** [December 15, 2021, 11:32pm UTC](https://forum.dfinity.org/t/deploying-to-new-canister-on-mainnet/9701/4 "2021-12-15T23:32:30Z")

</div>

Yep, as long as you configure it the way I demonstrate there

---

<div class="post-metadata">

**Author:** ![kevinli](https://avatars.discourse-cdn.com/v4/letter/k/8edcca/32.png) [@kevinli](https://forum.dfinity.org/u/kevinli)\
**Post date:** [December 15, 2021, 11:34pm UTC](https://forum.dfinity.org/t/deploying-to-new-canister-on-mainnet/9701/5 "2021-12-15T23:34:56Z")

</div>

dfx deploy --network staging gives and error:

```auto
The replica returned an HTTP Error: Http Error: status 404 Not Found, content type "text/html", content: <html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.21.3</center>
</body>
</html>

```

I saw this error on the other thread as well. Was this ever resolved?

---

<div class="post-metadata">

**Author:** ![anon74414410](https://avatars.discourse-cdn.com/v4/letter/a/85f322/32.png) [@anon74414410](https://forum.dfinity.org/u/anon74414410)\
**Post date:** [December 15, 2021, 11:45pm UTC](https://forum.dfinity.org/t/deploying-to-new-canister-on-mainnet/9701/6 "2021-12-15T23:45:59Z")

</div>

Ah, it’s failing because you don’t have a wallet configured for “staging”.

Run this:

```auto
dfx identity --network staging set-wallet $(dfx identity --network ic get-wallet)

```

I’ll add a note to the Readme

---

<div class="post-metadata">

**Author:** ![kevinli](https://avatars.discourse-cdn.com/v4/letter/k/8edcca/32.png) [@kevinli](https://forum.dfinity.org/u/kevinli)\
**Post date:** [December 16, 2021, 12:28am UTC](https://forum.dfinity.org/t/deploying-to-new-canister-on-mainnet/9701/7 "2021-12-16T00:28:27Z")

</div>

Hmm, I’m still getting

```auto
Installing canisters...
Creating UI canister on the staging network.
The replica returned an HTTP Error: Http Error: status 404 Not Found, content type "text/html", content: <html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.21.3</center>
</body>
</html>

```

---

<div class="post-metadata">

**Author:** ![kevinli](https://avatars.discourse-cdn.com/v4/letter/k/8edcca/32.png) [@kevinli](https://forum.dfinity.org/u/kevinli)\
**Post date:** [December 17, 2021, 3:21am UTC](https://forum.dfinity.org/t/deploying-to-new-canister-on-mainnet/9701/8 "2021-12-17T03:21:04Z")

</div>

@anon74414410 Do you know what might be causing the error? ^

---

<div class="post-metadata">

**Author:** ![anon74414410](https://avatars.discourse-cdn.com/v4/letter/a/85f322/32.png) [@anon74414410](https://forum.dfinity.org/u/anon74414410)\
**Post date:** [December 17, 2021, 6:32pm UTC](https://forum.dfinity.org/t/deploying-to-new-canister-on-mainnet/9701/9 "2021-12-17T18:32:37Z")

</div>

Maybe it’s trying to install the Candid UI canister? This didn’t happen when I ran it, so I’m not sure. Try specifying your canister short name with

```auto
dfx deploy --network staging <canister-name>

```

and definitely verify that the wallet is set up for staging correctly with

```auto
dfx identity --network staging get-wallet

```

---

<div class="post-metadata">

**Author:** ![kevinli](https://avatars.discourse-cdn.com/v4/letter/k/8edcca/32.png) [@kevinli](https://forum.dfinity.org/u/kevinli)\
**Post date:** [December 18, 2021, 1:01am UTC](https://forum.dfinity.org/t/deploying-to-new-canister-on-mainnet/9701/10 "2021-12-18T01:01:54Z")

</div>

It seems to keep trying to install the UI canister, even with dfx deploy --network staging . Is there a way to disable this?

---

<div class="post-metadata">

**Author:** ![anon74414410](https://avatars.discourse-cdn.com/v4/letter/a/85f322/32.png) [@anon74414410](https://forum.dfinity.org/u/anon74414410)\
**Post date:** [December 20, 2021, 4:52pm UTC](https://forum.dfinity.org/t/deploying-to-new-canister-on-mainnet/9701/11 "2021-12-20T16:52:07Z")

</div>

Specify the name of the canister in the command. It will only deploy the specific canister

---

<div class="post-metadata">

**Author:** ![kevinli](https://avatars.discourse-cdn.com/v4/letter/k/8edcca/32.png) [@kevinli](https://forum.dfinity.org/u/kevinli)\
**Post date:** [December 24, 2021, 9:59am UTC](https://forum.dfinity.org/t/deploying-to-new-canister-on-mainnet/9701/12 "2021-12-24T09:59:47Z")

</div>

It seemed to deploy correctly (I see the canister id when i go to .raw.ic0.app/, but I tried to change the code and deploy changes with `dfx deploy --network staging <canister name>`, but it still returns the same error:

```auto
Creating UI canister on the staging network.
The replica returned an HTTP Error: Http Error: status 404 Not Found, content type "text/html", content: <html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.21.3</center>
</body>
</html>

```

even when specifying deploying a particular name

---

<div class="post-metadata">

**Author:** ![kevinli](https://avatars.discourse-cdn.com/v4/letter/k/8edcca/32.png) [@kevinli](https://forum.dfinity.org/u/kevinli)\
**Post date:** [December 25, 2021, 10:51pm UTC](https://forum.dfinity.org/t/deploying-to-new-canister-on-mainnet/9701/13 "2021-12-25T22:51:07Z")

</div>

@anon74414410 Sorry for bothering you again, but do you know what might be going wrong ^? I’m pretty sure my dfx.json and whatnot is the same as the github you shared
