def push(self, registry, allow_insecure=False): remote_image_name = '{}/{}'.format(registry, self.name) self._docker_client.tag(self.name, remote_image_name) term.print_step('pushing image {}...'.format(remote_image_name)) stream = self._docker_client.push( remote_image_name, insecure_registry=allow_insecure, stream=True) consume_stream(stream) self._docker_client.remove_image(remote_image_name)
def pull(self, registry=None, allow_insecure=False): if registry: remote_image_name = '{}/{}'.format(registry, self.name) else: remote_image_name = self.name term.print_step('pulling image {}...'.format(remote_image_name)) stream = self._docker_client.pull( remote_image_name, insecure_registry=allow_insecure, stream=True) consume_stream(stream) if remote_image_name != self.name: self._docker_client.tag(remote_image_name, self.name, force=True) self._docker_client.remove_image(remote_image_name)
def build(self): term.print_step('building image {!r}...'.format(self.name)) stream = self._docker_client.build( self.path, tag=self.name, rm=True, forcerm=True) consume_stream(stream)