Nitro exposes a variety of ports and settings for you to customize using environment variables.
Looking to adjust resources?
Nitro uses whatever CPU, memory, and disk settings you’ve set for Docker. You can adjust these in Docker Desktop’s Resources panel and Nitro will automatically use them after Docker restarts.
# How to Customize Nitro’s Defaults
Let’s say you’re running another local development environment and the
portcheck command confirms port 80 (http) is already in use:
$ nitro portcheck 80 Port 80 is already in use...
Port 8080 seems like a fun, cool alternative so we’ll see if that’s available:
$ nitro portcheck 8080 Port 8080 is available!
Now we can use a shell environment variable setting Nitro’s http port to 8080:
If the value contains whitespace, wrap it in quotes (
Now run the
If you already ran
nitro init and configured Nitro earlier, you can open Docker desktop, delete the relevant container—in this case
nitro init. The container will be rebuilt and bind itself to our custom port.
Since we used
export NITRO_HTTP_PORT, we only set the value for our current terminal session. To have it persist, we can add it to our default shell profile:
echo 'export NITRO_HTTP_PORT=8080' >> ~/.zshrc
# Nitro Environment Variables
The table below details every environment variable you can use to customize Nitro, what it’s used for, whatever its default value is, and which container—if any—you’ll need to reinitialize for your customization to take effect.
|Environment Variable||Used By||Default||Container|
| ||http URLs|| |
| ||https URLs|| |
| ||gRPC|| |
| ||TLD for auto-suggested site hostnames|| ||n/a|
| ||Attempt to edit hosts file when applying changes?|| ||n/a|
| ||MailHog SMTP|| |
| ||node port|| |
| ||Alternate node port|| |
| ||MailHog web interface|| |
| ||DynamoDB server port|| |
| ||MinIO web interface and API|| |
| ||Redis server port|| |