deltaG=0 is the equilibrium condition at constant T and P.
In a sealed rigid container, though, the system is not at constant P so instead one must use the Helmholtz free energy, A. At constant T and V the equilibrium condition is that deltaA=0.
G=E+pV-TS and A=E-TS