Firefox Multi-Account Containers transform how you manage identity and session isolation across websites. Originally developed as an extension, containers are now deeply integrated into Firefox, offering developers and power users a robust mechanism to separate contexts without launching multiple browser instances. This guide walks you through practical setup, automation strategies, and real-world applications for your development workflow.
Understanding Firefox Containers
Firefox containers create isolated browsing contexts that persist cookies, local storage, and site data separately. Unlike incognito mode, containers maintain state across sessions—your logged-in state remains when you reopen the container. Each container has its own cookie jar, meaning you can be simultaneously logged into the same service with different accounts.
The Multi-Account Containers extension (or built-in container support in newer Firefox versions) enables you to:
- Run multiple accounts on the same site without logging out
- Isolate sensitive browsing from general activity
- Test web applications with clean state
- Separate development environments from personal browsing
Installing and Configuring Containers
If you’re running Firefox 115 or later, container support is built in. For earlier versions or additional features, install the Multi-Account Containers extension from Mozilla Add-ons:
# No direct install via CLI—use Firefox to navigate to:
# https://addons.mozilla.org/en-US/firefox/addon/multi-account-containers/
After installation, configure default containers in the extension settings. The default setup includes Personal, Work, Banking, and Shopping containers, but you should customize these for your workflow.
To create a custom container programmatically or configure it for your team:
// Firefox container configuration via about:config
// Navigate to: about:config
// Set container names (comma-separated)
pref("privacy.userContext.enabled", true);
pref("privacy.userContext.containerDefaults", "Development,Personal,Work,Testing");
// Customize container colors (hex values)
pref("privacy.userContext.personal.color", "#0078d4");
pref("privacy.userContext.work.color", "#107c10");
pref("privacy.userContext.development.color", "#d83b01");
Practical Development Workflows
Isolating Development Environments
When building web applications, you often need to test against different authentication states—logged out, regular user, admin user. Containers solve this elegantly:
- Create containers for each environment:
Dev-Local,Dev-Staging,Dev-Production - Log into each service with the appropriate test accounts
- Switch between environments instantly without clearing cookies or using private windows
// Automate container-based testing with Playwright
const { firefox } = require('playwright');
// Launch with specific container context
async function testInContainer(containerName) {
const context = await firefox.newContext({
containerScript: `
// This runs in Firefox context to assign container
let identity = Container.getIdentity('${containerName}');
identity.assignToCurrentDocument();
`
});
const page = await context.newPage();
await page.goto('https://your-app.dev');
return { page, context };
}
// Run tests across containers
async function runTests() {
await testInContainer('Dev-Local');
await testInContainer('Dev-Staging');
await testInContainer('Dev-Production');
}
Managing Multiple GitHub Accounts
Developers frequently maintain personal and work GitHub accounts. Containers let you stay logged into both simultaneously:
- Create
GitHub-Personalcontainer for your theluckystrike account - Create
GitHub-Workcontainer for your organization - Add the container switcher to your toolbar for one-click access
This eliminates constant log-out-log-in cycles when switching between repositories.
Testing Browser Fingerprinting
Privacy-conscious developers should test how their applications handle different container environments. Containers can help verify that your tracking protection works correctly:
// Test fingerprint consistency across containers
async function checkFingerprintIsolation() {
const containers = ['Personal', 'Work', 'Development'];
const fingerprints = [];
for (const container of containers) {
const context = await createContainerContext(container);
const page = await context.newPage();
// Collect fingerprintable attributes
const fp = await page.evaluate(() => ({
userAgent: navigator.userAgent,
language: navigator.language,
platform: navigator.platform,
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
screen: `${window.screen.width}x${window.screen.height}`
}));
fingerprints.push({ container, fp });
await context.close();
}
// Verify isolation—if containers work correctly,
// fingerprints should show container-specific settings
console.table(fingerprints);
}
Advanced Container Management
Container Keyboard Shortcuts
Master these shortcuts for rapid container switching:
Ctrl+Shift+1throughCtrl+Shift+4: Open URL in containers 1-4Ctrl+Shift+9: Open a new tab in the default containerCtrl+Shift+Space: Switch between the last two used containers
Organizing Containers with Labels
Use consistent naming conventions across your team or organization:
# Recommended container naming pattern
{Service}-{AccountType}
GitHub-Personal
GitHub-Work
AWS-Dev
AWS-Prod
Slack-TeamAlpha
Slack-TeamBeta
Container Synchronization
Firefox Sync can synchronize container tabs across devices, but be selective about what you sync:
// Configure about:config for container sync preferences
pref("services.sync.engine.tabs", true); // Enable tab sync
pref("privacy.userContext.ui.enabled", true); // Show container UI
Be cautious about syncing containers that contain sensitive credentials. Consider using local containers for high-security accounts rather than syncing them across devices.
Security Considerations
While containers provide excellent session isolation, they are not a replacement for proper security practices:
- Containers do not prevent network-level tracking by your ISP or network administrator
- Fingerprinting scripts can still identify you across containers using advanced techniques
- Local storage within containers persists until explicitly cleared
- Container data lives on disk; for sensitive work, use Firefox’s built-in memory protection features
For high-security workflows, combine containers with:
- Firefox’s Enhanced Tracking Protection (set to Strict mode)
- The resistFingerprinting setting in about:config
- HTTPS-only mode for all connections
Automating Container Tasks
You can script container operations using the Firefox Container API or browser automation tools:
// Using Firefox's container-script API
// Create a userChrome.css or userScript to auto-assign containers
// ==UserScript==
// @name Auto-assign GitHub to Work container
// @match https://github.com/*
// @container Work
// ==/UserScript==
// This automatically opens GitHub in your Work container
// every time you navigate to it
Best Practices for Container Organization
- Name containers consistently using a predictable pattern
- Color-code containers by context type (green for development, blue for personal, red for sensitive)
- Limit container count to what you can actively manage—typically 6-8 maximum
- Regularly audit containers and remove ones you no longer use
- Document your setup so you can recreate it on new machines
Conclusion
Firefox Multi-Account Containers provide a powerful mechanism for identity and session management without the overhead of multiple browser profiles. For developers, they offer instant environment switching, clean state testing, and separation of concerns that would otherwise require complex tooling or multiple browser instances.
Start with two or three containers matching your most common workflows, then expand as needed. The productivity gains from instant context switching become apparent within the first week of consistent use.
Related Reading
Built by theluckystrike — More at zovo.one