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!

Here are all of the videos in Local Development with Craft Nitro:

1What is Craft Nitro?Craft Nitro is a Docker-based local hosting solution by Pixel & Tonic, the developers of Craft. It is designed as an officially-supported way to handle local development of Craft CMS website builds, as well as when working on plugin development. 04:08
2Is Craft Nitro Right for Me?Five checks to see if Craft Nitro is the local development environment for you. 02:33
3How to Install Craft NitroInstalling Craft Nitro on macOS requires Docker, so that means you need to first have Docker Desktop for Mac installed and working. 09:20
4Creating Your First Site with NitroNow that we have Nitro installed, we are ready to create our first Craft hosted with Nitro. 09:49
5Setting Up A Boilerplate Project with Craft NitroIf you have a boilerplate project that you work with when starting new projects, it’s simple to use that to create a new Nitro project via the `nitro create` command. 04:35
6Migrating an Existing Project to Craft NitroMigrating an existing project to Nitro is probably going to be the most common scenario you run into, assuming you move all of your projects over instead of just using Nitro for new projects. 05:04
7Running Craft Commands Against a Craft Nitro SiteIt's best to run all `craft` commands through the `nitro` command. 02:15
8Craft CMS Multi-Site with Craft NitroSupporting a Craft multi-site installation with Craft Nitro requires using the `nitro alias` command. 04:33
9How to Recall Which Nitro Sites Are RunningI like to be able to get a quick peak and reminds myself of what’s what and if I’ve even set up a project in Nitro yet. 02:58
10Removing a Site from Craft NitroHere is how to remove a site from Craft Nitro. 03:05
11Testing Email Sending in Craft NitroIn addition to the core functionality of local hosting, Craft Nitro also has ancillary services that fill out the total experience of running a Craft site. 05:28
12Updating Craft NitroNitro is an actively maintained project by Pixel & Tonic. You’ll get the best experience with Nitro if you regularly update to get the latest features and improvements. 01:37
13Uninstalling Craft NitroIf you decide that Nitro isn’t for you or you need to troubleshoot an issue by uninstalling Nitro, then this is how to do it. 02:47
Course In-ProgressThis course is still being updated with new content. Check back for more!

Loading next video...