All Containers include a Disable property. This is what is used for the right-click Disable/Enable functionality you may have used when developing packages in the designer. Expressions are evaluated at run-time and can be used to set properties, so it follows that you could use an expression on the Disable property to control execution of the container.
This will not always work. By design, the Disable property is evaluated quite early on during package execution. This may be before you have set a variable that is subsequently used within your Disable property expression. This may caused unexpected results, and therefore should be avoided. The better way to disable a task is to use an expression within a precedence constraint. The expression will be evaluated when the constraint is tested, immediately before the constrained container is expected to execute, so it will always use the latest value for any variables or functions in the expression. Expressions on Precedence Constraints are easier to use, more visible, and as explained above, the correct way to disable your container.