Skip to main content




When a canister has been initially created, it is empty and does not contain code or state. It only contains information such as the settings, canister ID, cycles balance, and controllers. You can learn more about creating a canister in the creation documentation.

When a canister's code is installed, the following components are created:

  • The canister's code in the form of a canister module.

  • The canister's state, including the canister's memory and global values.

  • Additional IC-specific information, such as the canister's input and output queues.

Installing canister code

Code must be installed into the canister using the dfx canister install command:

dfx canister install canister_name // install canister code locally
dfx canister install canister_name --network ic // install canister code on the mainnet
dfx canister install --all // install all canisters in the project's dfx.json file

Creating a canister on the mainnet will cost cycles

At this step, settings can be configured for the canister using the optional flags. View the full list of settings that can be configured.


Failed to install Wasm module, no such file or directory.

If you receive an error such as:

Error: Failed to install wasm module to canister 'test'. Caused by: Failed to install wasm module to canister 'test'. Failed to read /home/gabriel/projects/motoko-test/.dfx/local/canisters/test/test.wasm. No such file or directory (os error 2)

You may need to run dfx build, as this error indicates that the canister's Wasm module may not exist because it was not compiled. Learn more about how to compile a canister's Wasm module. Alternatively, you can run dfx deploy, as it runs dfx build and dfx install as part of the deployment process.

Next steps