Local Development with Craft Nitro

Removing a Site from Craft Nitro

Here is how to remove a site from Craft Nitro.

When a project is over, it would be nice to remove a site from the Craft Nitro con­fig. Remov­ing a site from Nitro won’t remove the project files you have stored in your file sys­tem. This will only remove the site from the Nitro con­fig­u­ra­tion, and spin down the con­tain­er ded­i­cat­ed to that project.

The eas­i­est way to do this is to use the nitro remove com­mand. If you’re inside of a project direc­to­ry that is man­aged by Nitro then this com­mand will prompt you to con­firm that you want to remove the project in the cur­rent work­ing directory.

If, how­ev­er, you’re not in a project Nitro has con­fig­ured or just any­where else in your filesys­tem, then Nitro will prompt you to spec­i­fy the project you’d like to remove by selec­tion from a num­bered list of projects.

➜ nitro remove
Select a site:
  1. craft-starter.nitro
  2. craft-widgets.nitro
  3. craftquest.nitro
  4. downlink.nitro
  5. my-first-module.nitro
Enter your selection: 1
Removing craft-starter.nitro
Apply changes now [Y/n]?

Enter the num­ber and then press Return.

What hap­pens behind the scenes is Nitro will remove the project from the Nitro con­fig­u­ra­tion file, and apply those changes.

It does not:

  • spin down and destroy the Dock­er con­tain­er for that project
  • remove the data­base for that project.

To destroy the con­tain­er, you will need to run

➜ nitro apply

to apply the changes made in the con­fig­u­ra­tion file. As part of the apply rou­tine, Nitro will run nitro clean, which will go through and remove any unused containers.

To remove the data­base for the project, you need to run nitro db remove and choose the data­base con­tain­er and then the data­base you want to remove.

➜ nitro db remove
Which database engine?
  1. mysql-8.0-3307.database.nitro
  2. postgres-13-5432.database.nitro
Enter your selection: 1
Which database should we remove?
  1. brad
  2. craftquest
  3. craftstartagain
  4. craftstarter
realrawmilkfacts
Enter your selection: 3
  … removing craftstartagain ✓
Removed "craftstartagain" from "mysql-8.0-3307.database.nitro" successfully 💪

You’ve now suc­cess­ful­ly removed a project from Nitro!

Local Development with Craft Nitro is made up of the following videos: