How to find the domain of a composite function?

If you recall back to what a composite function is, it states that the domain is the set of all real numbers that composes both functions.

What about cases where we have restrictions? same rules apply but we must carry over restrictions from the first function to the second one and restrictions from the second one back to the first one.