Containers allow for cookies (a small file used for storing information) as well as other relevant files to be isolated either independently or collectively as a group (for example you could have a finance container). Isolating cookies inside of containers prevents other sites from being able to access them, thus increase both privacy and security.
If you'd like to read more about Containers, check out the Contexual Identities of the Web article by Tanvi Vyas.
The following explains how to use Firefox containers alongside temporary containers to increase your privacy while browsing. In this short tutorial we're going to be using the official Firefox Multi-Account Containers addon, as well as the Temporary Containers addon by Stoically.
Once installed, go to the Addons page in Firefox and find the Temporary Containers addon, and press the Options button.
These are the options we will be using, so go ahead and change them to the following:
All other settings on this page should be set to "Use Global"
All settings on this page should be set to "If the clicked Link Domain does not exactly match the current Tabs Domain (Subdomains also get isolated)"
Now that you have the addon set up, it's time to go ahead and set your most used websites into their own containers. Look for the container button on the top right of your browser.
Pressing this will access the container tab, allowing you to set categories (personally I set up a category for each site I frequently visit).
From this tab you can create new containers with the + sign at the bottom; for this demonstration I'm going to be making one called "Reddit". Once the container has been made, go back to the main menu and press the "Reddit" container, a new tab should show up with the colour you assigned.
Head over to Reddit and click the container button again, and click the "Always open in Reddit" button at the top; this will make sure that Reddit is always open in the correct container, repeat these steps for each website you want in its own container.
Once you assign a site to a container, the site will be loaded inside that container, however if you leave that sites domain, a new temporary container will be loaded instead of using the previous container, see below for a short demonstration:
Certain sites, like Google, use a different subdomain when authenticating users and allowing them to log in. Because this subdomain isn't part of the container of the parent domain, the container doesn't realise that it's the same person attempting to log in and in effect, anyone using containers without adding the subdomain to the appropriate container will be found in a loop.
To fix this we simply need to add the login subdomain to the same container we created for the parent domain, below is a gif showing you this process, in my example, for Google.
If you'd prefer to use Temporary Containers to fix this issue instead of Firefox's addon, /u/_decentralization has provided another solution to that issue that you can find down below:
And with that you've successfully set up containers for your most visited sites, as well as temporary containers for those sites you don't want sniffing around in cookies that don't belong to them.