Let \(\Omega\) be a subdomain in \(\mathbb{R}^n\) and \(M_\Omega\) be the local Hardy-Littlewood maximal function. In this paper, we show that both the commutator and the maximal commutator of \(M_\Omega\) are bounded and continuous from the first order Sobolev spaces \(W^{1,p_1}(\Omega)\) to \(W^{1,p}(\Omega)\) provided that \(b\in W^{1,p_2}(\Omega)\), \(1<p_1,p_2,p<\infty\) and \(1/p=1/p_1+1/p_2\). These are done by establishing several new pointwise estimates for the weak derivatives of the above commutators. As applications, the bounds of these operators on the Sobolev space with zero boundary values are obtained.