Moved the configuration of the container to the With() to avoid ordering
issues. Closes #2176