Example #1
0
// DockerCreateData creates a blank data container. It returns ErrContainerExists
// if such a container exists or other Docker errors.
//
//  ops.DataContainerName  - data container name to be created
//  ops.ContainerType      - container type
//  ops.ContainerNumber    - container number
//  ops.Labels             - container creation time labels (use LoadDataDefinition)
//
func DockerCreateData(ops *def.Operation) error {
	logger.Infof("Creating Data Container for =>\t%s\n", ops.DataContainerName)

	if _, exists := ContainerExists(ops); exists {
		logger.Infoln("Data container exists. Not creating.")
		return ErrContainerExists
	}

	optsData, err := configureDataContainer(def.BlankService(), ops, nil)
	if err != nil {
		return err
	}

	_, err = createContainer(optsData)
	if err != nil {
		return err
	}

	logger.Infof("Data Container ID =>\t\t%s\n", optsData.Name)
	return nil
}
Example #2
0
// DockerCreateData creates a blank data container. It returns ErrContainerExists
// if such a container exists or other Docker errors.
//
//  ops.DataContainerName  - data container name to be created
//  ops.ContainerType      - container type
//  ops.ContainerNumber    - container number
//  ops.Labels             - container creation time labels (use LoadDataDefinition)
//
func DockerCreateData(ops *def.Operation) error {
	log.WithField("=>", ops.DataContainerName).Info("Creating data container")

	if _, exists := ContainerExists(ops); exists {
		log.Info("Data container exists. Not creating")
		return ErrContainerExists
	}

	optsData, err := configureDataContainer(def.BlankService(), ops, nil)
	if err != nil {
		return err
	}

	_, err = createContainer(optsData)
	if err != nil {
		return err
	}

	log.WithField("=>", optsData.Name).Info("Data container created")

	return nil
}