To prevent proprietary code from being exposed to third parties, a cloud engineer should use private repositories for the containers. Private repositories ensure that access to container images is restricted and controlled, unlike public repositories where images are accessible to anyone.