Deletes a Docker image if it exists.
@param imageId the image ID (not null)
@param dockerClient a Docker client
541760
public static void deleteImageIfItExists( String imageId, DockerClient dockerClient ) {

		if( imageId != null ) {
			List<Image> images = dockerClient.listImagesCmd().exec();
			if( findImageById( imageId, images ) != null )
				dockerClient.removeImageCmd( imageId ).withForce( true ).exec();
		}
	}
581665
public void deleteService(String serviceId) {

        DeleteServiceRequest deleteServiceRequest = new DeleteServiceRequest().withId(serviceId);
        getDiscoveryClient().deleteService(deleteServiceRequest);

    }
983034
synchronized Container removeAndGet(final String containerId) {
    final Container result = this.containers.remove(containerId);
    if (null == result) {
      throw new RuntimeException("Unknown container to remove: " + containerId);
    }
    return result;
  }
256697
public static base_response delete(nitro_service client, String id) throws Exception {
		linkset deleteresource = new linkset();
		deleteresource.id = id;
		return deleteresource.delete_resource(client);
	}
157480
public void project_serviceName_storage_containerId_DELETE(String serviceName, String containerId) throws IOException {
		String qPath = "/cloud/project/{serviceName}/storage/{containerId}";
		StringBuilder sb = path(qPath, serviceName, containerId);
		exec(qPath, "DELETE", sb.toString(), null);
	}
591332
static void handleClientDisconnect(H2ONode client) {
    if(client != H2O.SELF) {
      if (H2O.isFlatfileEnabled()) {
        H2O.removeNodeFromFlatfile(client);
      }
      H2O.removeClient(client);
    }
  }
20702
public static xen_smx_gsbvpx_image delete(nitro_service client, xen_smx_gsbvpx_image resource) throws Exception
	{
		resource.validate("delete");
		return ((xen_smx_gsbvpx_image[]) resource.delete_resource(client))[0];
	}
241571
def delete(self):
        
        if not self.is_created():
            LOG.debug("Container was not created. Skipping deletion")
            return

        try:
            self.docker_client.containers\
                .get(self.id)\
                .remove(force=True)  # Remove a container, even if it is running
        except docker.errors.NotFound:
            # Container is already not there
            LOG.debug("Container with ID %s does not exist. Skipping deletion", self.id)
        except docker.errors.APIError as ex:
            msg = str(ex)
            removal_in_progress = ("removal of container" in msg) and ("is already in progress" in msg)

            # When removal is already started, Docker API will throw an exception
            # Skip such exceptions.
            if not removal_in_progress:
                raise ex

        self.id = None
456181
void createImage( String imageId ) throws TargetException {

		// If there is no Dockerfile, this method will do nothing
		File targetDirectory = this.parameters.getTargetPropertiesDirectory();
		String dockerFilePath = this.parameters.getTargetProperties().get( GENERATE_IMAGE_FROM );
		if( ! Utils.isEmptyOrWhitespaces( dockerFilePath ) && targetDirectory != null ) {

			this.logger.fine( "Trying to create image " + imageId + " from a Dockerfile." );
			File dockerFile = new File( targetDirectory, dockerFilePath );
			if( ! dockerFile.exists())
				throw new TargetException( "No Dockerfile was found at " + dockerFile );

			// Start the build.
			// This will block the current thread until the creation is complete.
			String builtImageId;
			this.logger.fine( "Asking Docker to build the image from our Dockerfile." );
			try {
				builtImageId = this.dockerClient
					.buildImageCmd( dockerFile )
					.withTags( Sets.newHashSet( imageId ))
					.withPull( true )
					.exec( new RoboconfBuildImageResultCallback())
					.awaitImageId();

			} catch( Exception e ) {
				Utils.logException( this.logger, e );
				throw new TargetException( e );
			}

			// No need to store the real image ID... Docker has it.
			// Besides, we search images by both IDs and tags.
			// Anyway, we can log the information.
			this.logger.fine( "Image '" + builtImageId + "' was succesfully generated by Roboconf." );
		}
	}
33072
public function removeImage($entityId)
    {
        if (!$entityId) {
            return false;
        }

        $delete = '
        UPDATE ' . $this->repository->getClassName() . ' a
        SET a.image = NULL
        WHERE a.id = ' . $entityId . '
        ';
        $q = $this->query($delete);
        $q->execute();
    }
997595
public void execInternal(@Nonnull final DockerClient client, @Nonnull final String imageName, TaskListener listener)
            throws IOException {
        PrintStream llog = listener.getLogger();

        if (shouldPullImage(client, imageName)) {
            LOG.info("Pulling image '{}'. This may take awhile...", imageName);
            llog.println(String.format("Pulling image '%s'. This may take awhile...", imageName));

            long startTime = System.currentTimeMillis();
            final PullImageCmd pullImageCmd = client.pullImageCmd(imageName);

//            final AuthConfig authConfig = pullImageCmd.getAuthConfig();
            for (DockerRegistryCredential cred : getRegistriesCreds()) {
                // hostname requirements?
                Credentials credentials = lookupSystemCredentials(cred.getCredentialsId());
//                final String registryAddr = cred.getRegistryAddr();
                if (credentials instanceof DockerRegistryAuthCredentials) {
                    final DockerRegistryAuthCredentials authCredentials = (DockerRegistryAuthCredentials) credentials;
                    // TODO update docker-java for multiple entries
                    pullImageCmd.withAuthConfig(authCredentials.getAuthConfig());
                }
            }
            // Deprecated
            if (StringUtils.isNotBlank(credentialsId)) {
                // hostname requirements?
                Credentials credentials = lookupSystemCredentials(credentialsId);
                if (credentials instanceof DockerRegistryAuthCredentials) {
                    final DockerRegistryAuthCredentials authCredentials = (DockerRegistryAuthCredentials) credentials;
                    pullImageCmd.withAuthConfig(authCredentials.getAuthConfig());
                }
            }

            try {
                pullImageCmd
                        .exec(new DockerPullImageListenerLogger(listener))
                        .awaitSuccess();
            } catch (DockerClientException exception) {
                String exMsg = exception.getMessage();
                if (exMsg.contains("Could not pull image: Digest:") ||
                        exMsg.contains(": downloaded")) {
                    try {
                        client.inspectImageCmd(imageName).exec();
                    } catch (NotFoundException notFoundEx) {
                        throw exception;
                    }
                } else {
                    throw exception;
                }
            }

            long pullTime = System.currentTimeMillis() - startTime;
            LOG.info("Finished pulling image '{}', took {} ms", imageName, pullTime);
            llog.println(String.format("Finished pulling image '%s', took %d ms", imageName, pullTime));
        }
    }
186679
public void project_serviceName_volume_snapshot_snapshotId_DELETE(String serviceName, String snapshotId) throws IOException {
		String qPath = "/cloud/project/{serviceName}/volume/snapshot/{snapshotId}";
		StringBuilder sb = path(qPath, serviceName, snapshotId);
		exec(qPath, "DELETE", sb.toString(), null);
	}
1250480
public void deleteServerGroup(int id) {
        try {
            sqlService.executeUpdate("DELETE FROM " + Constants.DB_TABLE_SERVER_GROUPS +
                                         " WHERE " + Constants.GENERIC_ID + " = " + id + ";");

            sqlService.executeUpdate("DELETE FROM " + Constants.DB_TABLE_SERVERS +
                                         " WHERE " + Constants.SERVER_REDIRECT_GROUP_ID + " = " + id);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
938899
public static base_response delete(nitro_service client, String neighbor) throws Exception {
		nd6 deleteresource = new nd6();
		deleteresource.neighbor = neighbor;
		return deleteresource.delete_resource(client);
	}
1126169
def delete_container(self, container):
        
        try:
            LOG.debug('delete_container() with %s is success.', self.driver)
            return self.driver.delete_container(container)
        except DriverException as e:
            LOG.exception('delete_container() with %s raised\
                            an exception %s.', self.driver, e)
1210910
def _remove(self, client_kwargs):
        
        with _handle_client_exception():
            # Object
            if 'obj' in client_kwargs:
                return self.client.delete_object(
                    client_kwargs['container'], client_kwargs['obj'])

            # Container
            return self.client.delete_container(client_kwargs['container'])
1174845
public static base_response delete(nitro_service client, Long clid) throws Exception {
		clusterinstance deleteresource = new clusterinstance();
		deleteresource.clid = clid;
		return deleteresource.delete_resource(client);
	}