def start_container()

in composer_local_dev/environment.py [0:0]


    def start_container(self, container_name: str = None, assert_not_running=True):
        """
        Start the given container
        """
        container = self.get_or_create_container(container_name)
        if (
                assert_not_running
                and container.status == constants.ContainerStatus.RUNNING
        ):
            raise errors.EnvironmentAlreadyRunningError(self.name) from None
        try:
            container.start()
            return container
        except docker.errors.APIError as err:
            logging.debug(
                "Starting environment failed with Docker API error.",
                exc_info=True,
            )
            # TODO: (b/234552960) Test on different OS/language setting
            if (
                    err.status_code == constants.SERVER_ERROR_CODE
                    and "port is already allocated" in str(err)
            ):
                container.remove()
                raise errors.ComposerCliError(
                    constants.PORT_IN_USE_ERROR.format(port=self.port)
                )
            error = f"Environment ({container_name}) failed to start with an error: {err}"
            raise errors.EnvironmentStartError(error) from None