We prove sufficient and necessary conditions for compactness of the Sobolev embeddings of Besov and Triebel–Lizorkin spaces defined on bounded and unbounded uniformly E-porous domains. The asymptotic behaviour of the corresponding entropy numbers is calculated. Some applications to the spectral properties of elliptic operators are described.